public interface MongoDao
| Modifier and Type | Method and Description |
|---|---|
long |
countObjects(java.lang.String collection,
com.mongodb.DBObject query)
Returns the count of objects matching the given query
in the given collection.
|
<T> T |
createObject(java.lang.String collection,
T object)
Creates the object in the given collection.
|
<T> T |
createObject(java.lang.String collection,
T object,
com.mongodb.WriteConcern conern)
Creates the object in the given collection.
|
<T> T[] |
createObjects(java.lang.String collection,
T[] objects)
Creates the given objects in the given collection.
|
<T> T[] |
createObjects(java.lang.String collection,
T[] objects,
com.mongodb.WriteConcern conern)
Creates the given objects in the given collection.
|
DaoQuery |
createQuery()
Creates a
DaoQuery and returns it. |
Statement |
createStatement(java.lang.String mql)
Creates a
Statement from the given mql code
and returns it. |
void |
deleteObject(java.lang.String collection,
java.lang.Object id)
Deletes the object with the given id from the
given collection.
|
void |
deleteObject(java.lang.String collection,
java.lang.Object id,
com.mongodb.WriteConcern concern)
Deletes the object with the given id from the
given collection.
|
void |
deleteObjects(java.lang.String collection,
com.mongodb.DBObject query)
Deletes the objects matching the given query from
the given collection.
|
void |
deleteObjects(java.lang.String collection,
com.mongodb.DBObject query,
com.mongodb.WriteConcern concern)
Deletes the objects matching the given query from
the given collection.
|
void |
deleteObjects(java.lang.String collection,
java.lang.Object[] ids)
Deletes the objects matching the given query from
the given collection.
|
void |
deleteObjects(java.lang.String collection,
java.lang.Object[] ids,
com.mongodb.WriteConcern concern)
Deletes the objects matching the given query from
the given collection.
|
void |
deletePartialObject(java.lang.String collection,
com.mongodb.DBObject query,
java.lang.String name)
Deletes a partial object.
|
void |
deletePartialObject(java.lang.String collection,
com.mongodb.DBObject query,
java.lang.String name,
com.mongodb.WriteConcern concern)
Deletes a partial object.
|
void |
deletePartialObject(java.lang.String collection,
java.lang.Object id,
java.lang.String name)
Deletes a partial object.
|
void |
deletePartialObject(java.lang.String collection,
java.lang.Object id,
java.lang.String name,
com.mongodb.WriteConcern concern)
Deletes a partial object.
|
void |
ensureIndex(java.lang.String collection,
com.mongodb.DBObject keys,
boolean background,
boolean unique,
boolean dropDupes)
Ensures that an index exists on the given collection.
|
void |
ensureIndex(java.lang.String collection,
java.lang.String key,
boolean background,
boolean unique,
boolean dropDupes)
Ensures that an index exists on the given collection.
|
com.mongodb.CommandResult |
executeCommand(com.mongodb.DBObject cmd)
Executes the given command.
|
com.mongodb.CommandResult |
executeCommand(java.lang.String cmd)
Executes the given command.
|
<T> T |
findAndDelete(java.lang.String collection,
com.mongodb.DBObject query,
com.mongodb.DBObject sort,
java.lang.Class<T> clazz)
Finds and removes the first object matching the query from
the given collection and returns it.
|
<T> T |
findAndDelete(java.lang.String collection,
com.mongodb.DBObject query,
com.mongodb.DBObject sort,
java.lang.Class<T> clazz,
java.lang.String[] fields)
Finds and removes the first object matching the query from
the given collection and returns it.
|
<T> T |
findAndModify(java.lang.String collection,
com.mongodb.DBObject query,
com.mongodb.DBObject sort,
com.mongodb.DBObject update,
boolean returnNew,
boolean upsert,
java.lang.Class<T> clazz)
Performs a find and modify.
|
<T> T |
findAndModify(java.lang.String collection,
com.mongodb.DBObject query,
com.mongodb.DBObject sort,
com.mongodb.DBObject update,
boolean returnNew,
boolean upsert,
java.lang.Class<T> clazz,
java.lang.String[] fields)
Performs a find and modify.
|
<T> ObjectIterator<T> |
findByExample(java.lang.String collection,
T example,
java.lang.Class<T> clazz)
Finds objects by the given example in the given
collection and returns an
ObjectIterator
for them. |
<T> T |
findObject(java.lang.String collection,
com.mongodb.DBObject query,
java.lang.Class<T> clazz)
Maps and returns a single object matching the given query
from the given collection.
|
<T> ObjectIterator<T> |
findObjects(java.lang.String collection,
com.mongodb.DBObject query,
java.lang.Class<T> clazz)
Maps and returns an
ObjectIterator for objects
matching the given query in the given collection. |
com.mongodb.DBCollection |
getCollection(java.lang.String name)
Returns a
DBCollection by it's name. |
com.mongodb.DB |
getDB()
Returns the underlying
DB. |
<T> T |
getPartialObject(java.lang.String collection,
com.mongodb.DBObject query,
java.lang.String name,
java.lang.Class<T> clazz)
Returns a partial object.
|
<T> T |
getPartialObject(java.lang.String collection,
java.lang.Object id,
java.lang.String name,
java.lang.Class<T> clazz)
Returns a partial object.
|
MapReduceResult |
mapReduce(java.lang.String collection,
MapReduce mapReduce)
Executes a MapReduce job using the given
MapReduceConfiguration. |
<T> T |
readObject(java.lang.String collection,
java.lang.Object id,
java.lang.Class<T> clazz)
Maps and returns an object from the given collection.
|
<T> T[] |
readObjects(java.lang.String collection,
java.lang.Object[] ids,
java.lang.Class<T> clazz)
Maps and returns a objects from the given collection.
|
<T> void |
savePartialObject(java.lang.String collection,
com.mongodb.DBObject query,
java.lang.String name,
T data,
boolean upsert,
com.mongodb.WriteConcern concern)
Saves a partial object.
|
<T> void |
savePartialObject(java.lang.String collection,
java.lang.Object id,
java.lang.String name,
T data,
boolean upsert)
Saves a partial object.
|
<T> void |
savePartialObject(java.lang.String collection,
java.lang.Object id,
java.lang.String name,
T data,
boolean upsert,
com.mongodb.WriteConcern concern)
Saves a partial object.
|
void |
update(java.lang.String collection,
com.mongodb.DBObject query,
com.mongodb.DBObject update,
boolean upsert,
boolean multi) |
void |
update(java.lang.String collection,
com.mongodb.DBObject query,
com.mongodb.DBObject update,
boolean upsert,
boolean multi,
com.mongodb.WriteConcern concern) |
void |
update(java.lang.String collection,
com.mongodb.DBObject query,
com.mongodb.DBObject update,
boolean upsert,
boolean multi,
com.mongodb.WriteConcern concern,
com.mongodb.DBEncoder encoder) |
void |
updateObject(java.lang.String collection,
java.lang.Object id,
java.lang.Object o)
Updates the object with the given id in the given
collection.
|
void |
updateObject(java.lang.String collection,
java.lang.Object id,
java.lang.Object o,
com.mongodb.WriteConcern concern)
Updates the object with the given id in the given
collection.
|
Statement createStatement(java.lang.String mql)
Statement from the given mql code
and returns it.mql - the MQL codeStatement<T> T createObject(java.lang.String collection,
T object)
T - the typecollection - the collectionobject - the object to create<T> T createObject(java.lang.String collection,
T object,
com.mongodb.WriteConcern conern)
T - the typecollection - the collectionobject - the object to createconern - the WriteConcern<T> T[] createObjects(java.lang.String collection,
T[] objects)
T - the typecollection - the collectionobjects - the objects to create<T> T[] createObjects(java.lang.String collection,
T[] objects,
com.mongodb.WriteConcern conern)
T - the typecollection - the collectionobjects - the objects to createconern - the WriteConcern<T> T readObject(java.lang.String collection,
java.lang.Object id,
java.lang.Class<T> clazz)
T - the typecollection - the collectionid - the object's idclazz - the object's class<T> T[] readObjects(java.lang.String collection,
java.lang.Object[] ids,
java.lang.Class<T> clazz)
T - the typecollection - the collectionids - the object's idclazz - the object's classvoid updateObject(java.lang.String collection,
java.lang.Object id,
java.lang.Object o)
collection - the collectionid - the ido - the objectvoid updateObject(java.lang.String collection,
java.lang.Object id,
java.lang.Object o,
com.mongodb.WriteConcern concern)
collection - the collectionid - the idconern - the WriteConcerno - the objectvoid deleteObject(java.lang.String collection,
java.lang.Object id)
collection - the collectionid - the idvoid deleteObject(java.lang.String collection,
java.lang.Object id,
com.mongodb.WriteConcern concern)
collection - the collectionconern - the WriteConcernid - the idvoid deleteObjects(java.lang.String collection,
com.mongodb.DBObject query)
collection - the collectionquery - the queryvoid deleteObjects(java.lang.String collection,
com.mongodb.DBObject query,
com.mongodb.WriteConcern concern)
collection - the collectionconern - the WriteConcernquery - the queryvoid deleteObjects(java.lang.String collection,
java.lang.Object[] ids)
collection - the collectionids - the ids of the objects to deletevoid deleteObjects(java.lang.String collection,
java.lang.Object[] ids,
com.mongodb.WriteConcern concern)
collection - the collectionconern - the WriteConcernids - the ids of the objects to delete<T> T getPartialObject(java.lang.String collection,
java.lang.Object id,
java.lang.String name,
java.lang.Class<T> clazz)
T - the partial object typecollection - the collectionid - the document's idname - the nameclazz - the type<T> T getPartialObject(java.lang.String collection,
com.mongodb.DBObject query,
java.lang.String name,
java.lang.Class<T> clazz)
T - the partial object typecollection - the collectionquery - the queryname - the nameclazz - the type<T> void savePartialObject(java.lang.String collection,
java.lang.Object id,
java.lang.String name,
T data,
boolean upsert)
T - the partial object typecollection - the collectionid - the document's idname - the namedata - the data to saveupsert - the upsert<T> void savePartialObject(java.lang.String collection,
java.lang.Object id,
java.lang.String name,
T data,
boolean upsert,
com.mongodb.WriteConcern concern)
T - the partial object typecollection - the collectionid - the document's idname - the namedata - the data to saveupsert - the upsertconern - the WriteConcern<T> void savePartialObject(java.lang.String collection,
com.mongodb.DBObject query,
java.lang.String name,
T data,
boolean upsert,
com.mongodb.WriteConcern concern)
T - the partial object typecollection - the collectionquery - the queryname - the namedata - the data to saveupsert - the upsertconern - the WriteConcernvoid deletePartialObject(java.lang.String collection,
java.lang.Object id,
java.lang.String name)
collection - the collectionid - the document's idname - the namevoid deletePartialObject(java.lang.String collection,
java.lang.Object id,
java.lang.String name,
com.mongodb.WriteConcern concern)
collection - the collectionid - the document's idname - the nameconern - the WriteConcernvoid deletePartialObject(java.lang.String collection,
com.mongodb.DBObject query,
java.lang.String name)
collection - the collectionquery - the queryname - the namevoid deletePartialObject(java.lang.String collection,
com.mongodb.DBObject query,
java.lang.String name,
com.mongodb.WriteConcern concern)
collection - the collectionquery - the queryname - the nameconern - the WriteConcern<T> ObjectIterator<T> findByExample(java.lang.String collection, T example, java.lang.Class<T> clazz)
ObjectIterator
for them.T - the object typecollection - the collectionexample - the exampleclazz - the classObjectIterator<T> ObjectIterator<T> findObjects(java.lang.String collection, com.mongodb.DBObject query, java.lang.Class<T> clazz)
ObjectIterator for objects
matching the given query in the given collection.T - the typecollection - the collectionquery - the queryclazz - the java type to map the objects toObjectIteratorlong countObjects(java.lang.String collection,
com.mongodb.DBObject query)
collection - the collectionquery - the query<T> T findObject(java.lang.String collection,
com.mongodb.DBObject query,
java.lang.Class<T> clazz)
T - the typecollection - the collectionquery - the queryclazz - the java type to map the objects tocom.mongodb.CommandResult executeCommand(com.mongodb.DBObject cmd)
cmd - the command to executecom.mongodb.CommandResult executeCommand(java.lang.String cmd)
cmd - the command to executeMapReduceResult mapReduce(java.lang.String collection, MapReduce mapReduce)
MapReduceConfiguration.collection - the collection to run in onmapReduce - the MapReduceMapReduceOutputvoid ensureIndex(java.lang.String collection,
java.lang.String key,
boolean background,
boolean unique,
boolean dropDupes)
collection - the collectionkey - the keybackground - whether or not to build the index in the backgroundunique - if it's a unique indexdropDupes - whether or not to drop duplicate documentsvoid ensureIndex(java.lang.String collection,
com.mongodb.DBObject keys,
boolean background,
boolean unique,
boolean dropDupes)
collection - the collectionkeys - the keysbackground - whether or not to build the index in the backgroundunique - if it's a unique indexdropDupes - whether or not to drop duplicate documents<T> T findAndDelete(java.lang.String collection,
com.mongodb.DBObject query,
com.mongodb.DBObject sort,
java.lang.Class<T> clazz,
java.lang.String[] fields)
collection - the collectionquery - the queryclazz - the classfields - the fields to populate in the return object<T> T findAndDelete(java.lang.String collection,
com.mongodb.DBObject query,
com.mongodb.DBObject sort,
java.lang.Class<T> clazz)
collection - the collectionquery - the queryclazz - the classfields - the fields to populate in the return object<T> T findAndModify(java.lang.String collection,
com.mongodb.DBObject query,
com.mongodb.DBObject sort,
com.mongodb.DBObject update,
boolean returnNew,
boolean upsert,
java.lang.Class<T> clazz)
collection - the collectionquery - the querysort - the sort optionupdate - the update objectreturnNew - whether or not to return the new or old valueupsert - create if it doesn't existclazz - the type<T> T findAndModify(java.lang.String collection,
com.mongodb.DBObject query,
com.mongodb.DBObject sort,
com.mongodb.DBObject update,
boolean returnNew,
boolean upsert,
java.lang.Class<T> clazz,
java.lang.String[] fields)
collection - the collectionquery - the querysort - the sort optionupdate - the update objectreturnNew - whether or not to return the new or old valueupsert - create if it doesn't existclazz - the typefields - the fields to populate in the return objectvoid update(java.lang.String collection,
com.mongodb.DBObject query,
com.mongodb.DBObject update,
boolean upsert,
boolean multi,
com.mongodb.WriteConcern concern,
com.mongodb.DBEncoder encoder)
void update(java.lang.String collection,
com.mongodb.DBObject query,
com.mongodb.DBObject update,
boolean upsert,
boolean multi,
com.mongodb.WriteConcern concern)
void update(java.lang.String collection,
com.mongodb.DBObject query,
com.mongodb.DBObject update,
boolean upsert,
boolean multi)
com.mongodb.DB getDB()
DB.DBcom.mongodb.DBCollection getCollection(java.lang.String name)
DBCollection by it's name.name - the nameDBCollectionCopyright © 2013. All Rights Reserved.