类 CollectionImpl

    • 方法详细资料

      • getName

        public String getName()
        从接口复制的说明: DatabaseObject
        Retrieve the name of the database object represented by the Java object.
        指定者:
        getName 在接口中 DatabaseObject
        返回:
        name
      • find

        public FindStatement find​(String searchCondition)
        从接口复制的说明: Collection
        Create a new find statement retrieving documents matching the given search condition.
        指定者:
        find 在接口中 Collection
        参数:
        searchCondition - condition expression
        返回:
        FindStatement
      • createIndex

        public Result createIndex​(String indexName,
                                  DbDoc indexDefinition)
        从接口复制的说明: Collection
        Create a new statement defining the creation of an index on this collection.

        Example: collection.createIndex("myIndex", "{\"fields\": [{\"field\": \"$.myGeoJsonField\", \"type\": \"GEOJSON\", \"required\": true, \"options\": 2, \"srid\": 4326}], \"type\":\"SPATIAL\"}");

        指定者:
        createIndex 在接口中 Collection
        参数:
        indexName - index name
        indexDefinition - JSON document with the following fields:
        • fields: array of IndexField objects, each describing a single document member to be included in the index (see below)
        • type: string, (optional) the type of index. One of INDEX or SPATIAL (case insensitive). Default is INDEX and may be omitted.
        where single IndexField description consists of the following fields:
        • field: string, the full document path to the document member or field to be indexed
        • type: string, one of the supported SQL column types to map the field into (see below for a list). For numeric types, the optional UNSIGNED keyword may follow. For the TEXT type, the length to consider for indexing may be added. Type descriptions are case insensitive.
        • required: bool, (optional) true if the field is required to exist in the document. Defaults to false, except for GEOJSON where it defaults to true
        • options: int, (optional) special option flags for use when decoding GEOJSON data
        • srid: int, (optional) srid value for use when decoding GEOJSON data
        返回:
        Result
      • createIndex

        public Result createIndex​(String indexName,
                                  String jsonIndexDefinition)
        从接口复制的说明: Collection
        Create a new statement defining the creation of an index on this collection.

        Example: collection.createIndex("myIndex", "{\"fields\": [{\"field\": \"$.myGeoJsonField\", \"type\": \"GEOJSON\", \"required\": true, \"options\": 2, \"srid\": 4326}], \"type\":\"SPATIAL\"}");

        指定者:
        createIndex 在接口中 Collection
        参数:
        indexName - index name
        jsonIndexDefinition - JSON document with the following fields:
        • fields: array of IndexField objects, each describing a single document member to be included in the index (see below)
        • type: string, (optional) the type of index. One of INDEX or SPATIAL. Default is INDEX and may be omitted.
        where single IndexField description consists of the following fields:
        • field: string, the full document path to the document member or field to be indexed
        • type: string, one of the supported SQL column types to map the field into (see below for a list). For numeric types, the optional UNSIGNED keyword may follow. For the TEXT type, the length to consider for indexing may be added.
        • required: bool, (optional) true if the field is required to exist in the document. Defaults to false, except for GEOJSON where it defaults to true
        • options: int, (optional) special option flags for use when decoding GEOJSON data
        • srid: int, (optional) srid value for use when decoding GEOJSON data
        返回:
        Result
      • dropIndex

        public void dropIndex​(String indexName)
        从接口复制的说明: Collection
        Create a new statement defining the removal of an index on this collection.
        指定者:
        dropIndex 在接口中 Collection
        参数:
        indexName - index name
      • count

        public long count()
        从接口复制的说明: Collection
        Query the number of documents in this collection.
        指定者:
        count 在接口中 Collection
        返回:
        The number of documents in this collection
      • hashCode

        public int hashCode()
        覆盖:
        hashCode 在类中 Object
      • replaceOne

        public Result replaceOne​(String id,
                                 DbDoc doc)
        从接口复制的说明: Collection
        Takes in a document object that will replace the matching document. If no matches are found, the function returns normally with no changes being made.
        指定者:
        replaceOne 在接口中 Collection
        参数:
        id - the document id of the document to be replaced
        doc - the new document, which may contain expressions. If document contains an _id value, it is ignored.
        返回:
        Result object, which will indicate the number of affected documents (1 or 0, if none)
      • replaceOne

        public Result replaceOne​(String id,
                                 String jsonString)
        从接口复制的说明: Collection
        Takes in a document object that will replace the matching document. If no matches are found, the function returns normally with no changes being made.
        指定者:
        replaceOne 在接口中 Collection
        参数:
        id - the document id of the document to be replaced
        jsonString - the new document, given as JSON string, which may contain expressions. If document contains an _id value, it is ignored.
        返回:
        Result object, which will indicate the number of affected documents (1 or 0, if none)
      • addOrReplaceOne

        public Result addOrReplaceOne​(String id,
                                      DbDoc doc)
        从接口复制的说明: Collection
        Adds the document to the collection. The following algorithm applies:
        指定者:
        addOrReplaceOne 在接口中 Collection
        参数:
        id - the document id of the document to be replaced
        doc - the new document, which may contain expressions. If doc contains an _id value and it does not match the given id then the error will be thrown.
        返回:
        Result object, which will indicate the number of affected documents (0 - if none, 1 - if added, 2 - if replaced)
      • addOrReplaceOne

        public Result addOrReplaceOne​(String id,
                                      String jsonString)
        从接口复制的说明: Collection
        Adds the document to the collection. The following algorithm applies:
        指定者:
        addOrReplaceOne 在接口中 Collection
        参数:
        id - the document id of the document to be replaced
        jsonString - the new document, given as JSON string, which may contain expressions. If doc contains an _id value and it does not match the given id then the error will be thrown.
        返回:
        Result object, which will indicate the number of affected documents (0 - if none, 1 - if added, 2 - if replaced)
      • getOne

        public DbDoc getOne​(String id)
        从接口复制的说明: Collection
        Return the document with the given id.
        指定者:
        getOne 在接口中 Collection
        参数:
        id - the document id of the document to be retrieved
        返回:
        the document, or NULL if no match found
      • removeOne

        public Result removeOne​(String id)
        从接口复制的说明: Collection
        Removes the document with the given id.
        指定者:
        removeOne 在接口中 Collection
        参数:
        id - the document id of the document to be removed
        返回:
        Returns a Result object, which will indicate the number of removed documents (1 or 0, if none)