public class CollectionImpl extends java.lang.Object implements Collection
DatabaseObject.DbObjectStatus, DatabaseObject.DbObjectType| Modifier and Type | Method and Description |
|---|---|
AddStatement |
add(DbDoc... docs)
Add a sequence of documents.
|
AddStatement |
add(DbDoc doc)
Add a document in the form of a DbDoc.
|
AddStatement |
add(java.util.Map<java.lang.String,?> doc)
Add a document in the form of a Map.
|
AddStatement |
add(java.lang.String... jsonString)
Add one or more documents.
|
Result |
addOrReplaceOne(java.lang.String id,
DbDoc doc)
Adds the document to the collection.
|
Result |
addOrReplaceOne(java.lang.String id,
java.lang.String jsonString)
Adds the document to the collection.
|
long |
count()
Query the number of documents in this collection.
|
Result |
createIndex(java.lang.String indexName,
DbDoc indexDefinition)
Create a new statement defining the creation of an index on this collection.
|
Result |
createIndex(java.lang.String indexName,
java.lang.String jsonIndexDefinition)
Create a new statement defining the creation of an index on this collection.
|
void |
dropIndex(java.lang.String indexName)
Create a new statement defining the removal of an index on this collection.
|
boolean |
equals(java.lang.Object other) |
DatabaseObject.DbObjectStatus |
existsInDatabase()
Query the existence of this database object.
|
FindStatement |
find()
Create a new find statement retrieving all documents in the collection.
|
FindStatement |
find(java.lang.String searchCondition)
Create a new find statement retrieving documents matching the given search condition.
|
java.lang.String |
getName()
Retrieve the name of the database object represented by the Java object.
|
DbDoc |
getOne(java.lang.String id)
Return the document with the given id.
|
Schema |
getSchema()
Retrieve the schema owning this database object.
|
Session |
getSession()
Retrieve the session owning the given schema object.
|
int |
hashCode() |
ModifyStatement |
modify(java.lang.String searchCondition)
Create a new modify statement affecting documents matching the given search condition.
|
DbDoc |
newDoc()
Create a new document.
|
RemoveStatement |
remove(java.lang.String searchCondition)
Create a new removal statement affecting documents matching the given search condition.
|
Result |
removeOne(java.lang.String id)
Removes the document with the given id.
|
Result |
replaceOne(java.lang.String id,
DbDoc doc)
Takes in a document object that will replace the matching document.
|
Result |
replaceOne(java.lang.String id,
java.lang.String jsonString)
Takes in a document object that will replace the matching document.
|
java.lang.String |
toString() |
public Session getSession()
DatabaseObjectgetSession in interface DatabaseObjectSessionpublic Schema getSchema()
DatabaseObjectgetSchema in interface DatabaseObjectSchemapublic java.lang.String getName()
DatabaseObjectgetName in interface DatabaseObjectpublic DatabaseObject.DbObjectStatus existsInDatabase()
DatabaseObjectexistsInDatabase in interface DatabaseObjectDatabaseObject.DbObjectStatuspublic AddStatement add(java.util.Map<java.lang.String,?> doc)
Collectionadd in interface Collectiondoc - map of key-value parameters representing the document fieldsAddStatementpublic AddStatement add(java.lang.String... jsonString)
Collectionadd in interface CollectionjsonString - one or more documents given as JSON stringsAddStatementpublic AddStatement add(DbDoc doc)
Collectionadd in interface Collectiondoc - DbDocAddStatementpublic AddStatement add(DbDoc... docs)
Collectionadd in interface Collectiondocs - one or more documents given as DbDocAddStatementpublic FindStatement find()
Collectionfind in interface CollectionFindStatementpublic FindStatement find(java.lang.String searchCondition)
Collectionfind in interface CollectionsearchCondition - condition expressionFindStatementpublic ModifyStatement modify(java.lang.String searchCondition)
Collectionmodify in interface CollectionsearchCondition - condition expressionModifyStatementpublic RemoveStatement remove(java.lang.String searchCondition)
Collectionremove in interface CollectionsearchCondition - condition expressionRemoveStatementpublic Result createIndex(java.lang.String indexName, DbDoc indexDefinition)
CollectionExample: collection.createIndex("myIndex", "{\"fields\": [{\"field\": \"$.myGeoJsonField\", \"type\": \"GEOJSON\", \"required\": true, \"options\": 2, \"srid\": 4326}], \"type\":\"SPATIAL\"}");
createIndex in interface CollectionindexName - index nameindexDefinition - JSON document with the following fields:
Resultpublic Result createIndex(java.lang.String indexName, java.lang.String jsonIndexDefinition)
CollectionExample: collection.createIndex("myIndex", "{\"fields\": [{\"field\": \"$.myGeoJsonField\", \"type\": \"GEOJSON\", \"required\": true, \"options\": 2, \"srid\": 4326}], \"type\":\"SPATIAL\"}");
createIndex in interface CollectionindexName - index namejsonIndexDefinition - JSON document with the following fields:
Resultpublic void dropIndex(java.lang.String indexName)
CollectiondropIndex in interface CollectionindexName - index namepublic long count()
Collectioncount in interface Collectionpublic DbDoc newDoc()
CollectionnewDoc in interface CollectionDbDocpublic boolean equals(java.lang.Object other)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Objectpublic Result replaceOne(java.lang.String id, DbDoc doc)
CollectionreplaceOne in interface Collectionid - the document id of the document to be replaceddoc - the new document, which may contain expressions. If document contains an _id value, it is ignored.public Result replaceOne(java.lang.String id, java.lang.String jsonString)
CollectionreplaceOne in interface Collectionid - the document id of the document to be replacedjsonString - the new document, given as JSON string, which may contain expressions. If document contains an _id value, it is ignored.public Result addOrReplaceOne(java.lang.String id, DbDoc doc)
CollectionaddOrReplaceOne in interface Collectionid - the document id of the document to be replaceddoc - 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.public Result addOrReplaceOne(java.lang.String id, java.lang.String jsonString)
CollectionaddOrReplaceOne in interface Collectionid - the document id of the document to be replacedjsonString - 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.public DbDoc getOne(java.lang.String id)
CollectiongetOne in interface Collectionid - the document id of the document to be retrievedpublic Result removeOne(java.lang.String id)
CollectionremoveOne in interface Collectionid - the document id of the document to be removed