public class DatastoreImpl extends Object implements AdvancedDatastore
| Constructor and Description |
|---|
DatastoreImpl(Morphia morphia,
Mapper mapper,
MongoClient mongoClient,
String dbName)
Create a new DatastoreImpl
|
DatastoreImpl(Morphia morphia,
MongoClient mongoClient,
String dbName)
Create a new DatastoreImpl
|
| Modifier and Type | Method and Description |
|---|---|
DatastoreImpl |
copy(String database) |
AggregationPipeline |
createAggregation(Class source)
Returns a new query bound to the kind (a specific
DBCollection) |
<T> Query<T> |
createQuery(Class<T> type)
Returns a new query bound to the kind (a specific
DBCollection) |
<T> Query<T> |
createQuery(Class<T> type,
DBObject q) |
<T> Query<T> |
createQuery(String kind,
Class<T> type) |
<T> Query<T> |
createQuery(String kind,
Class<T> type,
DBObject q) |
<T,V> DBRef |
createRef(Class<T> clazz,
V id)
Creates a reference to the entity (using the current DB -can be null-, the collectionName, and id)
|
<T> DBRef |
createRef(T entity)
Creates a reference to the entity (using the current DB -can be null-, the collectionName, and id)
|
<T> UpdateOperations<T> |
createUpdateOperations(Class<T> clazz)
The builder for all update operations
|
<T> UpdateOperations<T> |
createUpdateOperations(Class<T> kind,
DBObject ops) |
<T,V> WriteResult |
delete(Class<T> clazz,
Iterable<V> ids)
Deletes the given entities (by id)
|
<T,V> WriteResult |
delete(Class<T> clazz,
V id)
Deletes the given entity (by id)
|
<T,V> WriteResult |
delete(Class<T> clazz,
V id,
WriteConcern wc) |
<T> WriteResult |
delete(Query<T> query)
Deletes the given entities based on the query
|
<T> WriteResult |
delete(Query<T> query,
WriteConcern wc)
Deletes the given entities based on the query, with the WriteConcern
|
<T,V> WriteResult |
delete(String kind,
Class<T> clazz,
V id)
Deletes an entity of the given type T, with the given
id, from the collection with the name in the kind param. |
<T,V> WriteResult |
delete(String kind,
Class<T> clazz,
V id,
WriteConcern wc)
Deletes an entity of the given type T, with the given
id, from the collection with the name in the kind param. |
<T> WriteResult |
delete(T entity)
Deletes the given entity (by @Id)
|
<T> WriteResult |
delete(T entity,
WriteConcern wc)
Deletes the given entity (by @Id), with the WriteConcern
|
void |
ensureCaps()
ensure capped DBCollections for
Entity(s) |
<T> void |
ensureIndex(Class<T> type,
String fields)
Ensures (creating if necessary) the index including the field(s) + directions; eg fields = "field1, -field2" ({field1:1, field2:-1})
|
protected <T> void |
ensureIndex(Class<T> clazz,
String name,
BasicDBObject fields,
boolean unique,
boolean dropDupsOnCreate,
boolean background,
boolean sparse,
int expireAfterSeconds) |
<T> void |
ensureIndex(Class<T> clazz,
String name,
String fields,
boolean unique,
boolean dropDupsOnCreate)
Ensures (creating if necessary) the index including the field(s) + directions; eg fields = "field1, -field2" ({field1:1, field2:-1})
|
protected void |
ensureIndex(DBCollection dbColl,
String name,
BasicDBObject fields,
boolean unique,
boolean dropDupsOnCreate,
boolean background,
boolean sparse,
int expireAfterSeconds) |
protected void |
ensureIndex(MappedClass mc,
DBCollection dbColl,
Field[] fields,
IndexOptions options) |
<T> void |
ensureIndex(String collName,
Class<T> type,
String fields)
Ensures (creating if necessary) the index including the field(s) + directions on the given collection name; eg fields = "field1,
-field2" ({field1:1, field2:-1})
|
<T> void |
ensureIndex(String collName,
Class<T> clazz,
String name,
String fields,
boolean unique,
boolean dropDupsOnCreate)
Ensures (creating if necessary) the index including the field(s) + directions on the given collection name; eg fields = "field1,
-field2" ({field1:1, field2:-1})
|
void |
ensureIndexes()
Ensures (creating if necessary) the indexes found during class mapping (using
@Indexed, @Indexes) |
void |
ensureIndexes(boolean background)
Ensures (creating if necessary) the indexes found during class mapping (using
@Indexed, @Indexes), possibly in the
background |
<T> void |
ensureIndexes(Class<T> clazz)
Ensures (creating if necessary) the indexes found during class mapping (using
@Indexed, @Indexes) |
<T> void |
ensureIndexes(Class<T> clazz,
boolean background)
Ensures (creating if necessary) the indexes found during class mapping (using
@Indexed, @Indexes), possibly in the
background |
protected void |
ensureIndexes(DBCollection dbColl,
MappedClass mc,
boolean background,
List<MappedClass> parentMCs,
List<MappedField> parentMFs) |
protected void |
ensureIndexes(MappedClass mc,
boolean background) |
protected void |
ensureIndexes(MappedClass mc,
boolean background,
List<MappedClass> parentMCs,
List<MappedField> parentMFs) |
<T> void |
ensureIndexes(String collName,
Class<T> clazz)
Ensures (creating if necessary) the indexes found during class mapping (using
@Indexed, @Indexes) on the given collection
name. |
<T> void |
ensureIndexes(String collName,
Class<T> clazz,
boolean background)
Ensures (creating if necessary) the indexes found during class mapping (using
@Indexed, @Indexes) on the given collection
name, possibly in the background |
protected void |
ensureIndexes(String collName,
MappedClass mc,
boolean background) |
Key<?> |
exists(Object entityOrKey)
Does a query to check if the keyOrEntity exists in mongodb
|
Key<?> |
exists(Object entityOrKey,
ReadPreference readPreference) |
<T> Query<T> |
find(Class<T> clazz)
Find all instances by type
|
<T,V> Query<T> |
find(Class<T> clazz,
String property,
V value)
Find all instances by collectionName, and filter property.
|
<T,V> Query<T> |
find(Class<T> clazz,
String property,
V value,
int offset,
int size)
Find all instances by collectionName, and filter property.
|
<T> Query<T> |
find(String kind,
Class<T> clazz) |
<T,V> Query<T> |
find(String kind,
Class<T> clazz,
String property,
V value,
int offset,
int size) |
<T,V> Query<T> |
find(String kind,
Class<T> clazz,
String property,
V value,
int offset,
int size,
boolean validate) |
<T> T |
findAndDelete(Query<T> qi)
Deletes the given entities based on the query (first item only).
|
<T> T |
findAndModify(Query<T> q,
UpdateOperations<T> ops)
Find the first Entity from the Query, and modify it.
|
<T> T |
findAndModify(Query<T> query,
UpdateOperations<T> ops,
boolean oldVersion)
Find the first Entity from the Query, and modify it.
|
<T> T |
findAndModify(Query<T> qi,
UpdateOperations<T> ops,
boolean oldVersion,
boolean createIfMissing)
Find the first Entity from the Query, and modify it.
|
<T> T |
get(Class<T> clazz,
DBRef ref)
Find the given entity (by collectionName/id);
|
<T,V> Query<T> |
get(Class<T> clazz,
Iterable<V> ids)
Find the given entities (by id); shorthand for
find("_id in", ids) |
<T,V> T |
get(Class<T> clazz,
V id)
Find the given entity (by id); shorthand for
find("_id ", id) |
<T,V> T |
get(String kind,
Class<T> clazz,
V id) |
<T> T |
get(T entity)
Find the given entity (by collectionName/id); think of this as refresh
|
<T> T |
getByKey(Class<T> clazz,
Key<T> key)
Find the given entity (by collectionName/id);
|
<T> List<T> |
getByKeys(Class<T> clazz,
Iterable<Key<T>> keys)
Find the given entities (by id), verifying they are of the correct type; shorthand for
find("_id in", ids) |
<T> List<T> |
getByKeys(Iterable<Key<T>> keys)
Find the given entities (by id); shorthand for
find("_id in", ids) |
DBCollection |
getCollection(Class clazz) |
DBCollection |
getCollection(Object obj) |
protected DBCollection |
getCollection(String kind) |
<T> long |
getCount(Class<T> clazz)
Gets the count this kind (
DBCollection) |
<T> long |
getCount(Query<T> query)
Gets the count of items returned by this query; same as
query.countAll() |
long |
getCount(String kind)
Gets the count this kind
|
<T> long |
getCount(T entity)
Gets the count this kind (
DBCollection) |
DB |
getDB() |
DBDecoderFactory |
getDecoderFact() |
WriteConcern |
getDefaultWriteConcern() |
protected Object |
getId(Object entity)
Deprecated.
|
<T> Key<T> |
getKey(T entity)
Deprecated.
|
Mapper |
getMapper() |
MongoClient |
getMongo()
Get the underlying MongoClient that allows connection to the MongoDB instance being used.
|
QueryFactory |
getQueryFactory()
Returns the current
QueryFactory. |
WriteConcern |
getWriteConcern(Object clazzOrEntity)
Gets the write concern for entity or returns the default write concern for this datastore
|
protected <T> Key<T> |
insert(DBCollection dbColl,
T entity,
WriteConcern wc) |
<T> Iterable<Key<T>> |
insert(Iterable<T> entities) |
<T> Iterable<Key<T>> |
insert(Iterable<T> entities,
WriteConcern wc) |
<T> Iterable<Key<T>> |
insert(String kind,
Iterable<T> entities) |
<T> Iterable<Key<T>> |
insert(String kind,
Iterable<T> entities,
WriteConcern wc) |
<T> Key<T> |
insert(String kind,
T entity) |
<T> Key<T> |
insert(String kind,
T entity,
WriteConcern wc) |
<T> Iterable<Key<T>> |
insert(T... entities) |
<T> Key<T> |
insert(T entity) |
<T> Key<T> |
insert(T entity,
WriteConcern wc) |
<T> MapreduceResults<T> |
mapReduce(MapreduceType type,
Query query,
Class<T> outputType,
MapReduceCommand baseCommand)
Runs a map/reduce job at the server; this should be used with a server version 1.7.4 or higher
|
<T> MapreduceResults<T> |
mapReduce(MapreduceType type,
Query query,
String map,
String reduce,
String finalize,
Map<String,Object> scopeFields,
Class<T> outputType)
Runs a map/reduce job at the server; this should be used with a server version 1.7.4 or higher
|
<T> Key<T> |
merge(T entity)
Work as if you did an update with each field in the entity doing a $set; Only at the top level of the entity.
|
<T> Key<T> |
merge(T entity,
WriteConcern wc)
Work as if you did an update with each field in the entity doing a $set; Only at the top level of the entity.
|
static long |
nextValue(Long oldVersion) |
<T> Query<T> |
queryByExample(String kind,
T ex)
Returns a new query based on the example object
|
<T> Query<T> |
queryByExample(T ex)
Returns a new query based on the example object
|
protected <T> Key<T> |
save(DBCollection dbColl,
T entity,
WriteConcern wc) |
<T> Iterable<Key<T>> |
save(Iterable<T> entities)
Saves the entities (Objects) and updates the @Id field
|
<T> Iterable<Key<T>> |
save(Iterable<T> entities,
WriteConcern wc)
Saves the entities (Objects) and updates the @Id field, with the WriteConcern
|
<T> Key<T> |
save(String kind,
T entity) |
<T> Key<T> |
save(String kind,
T entity,
WriteConcern wc) |
<T> Iterable<Key<T>> |
save(T... entities)
Saves the entities (Objects) and updates the @Id field
|
<T> Key<T> |
save(T entity)
Saves the entity (Object) and updates the @Id field
|
<T> Key<T> |
save(T entity,
WriteConcern wc)
Saves the entity (Object) and updates the @Id field, with the WriteConcern
|
DBDecoderFactory |
setDecoderFact(DBDecoderFactory fact) |
void |
setDefaultWriteConcern(WriteConcern wc) |
void |
setQueryFactory(QueryFactory queryFactory)
Replaces the current
QueryFactory with the given value. |
protected <T> WriteResult |
tryVersionedUpdate(DBCollection dbColl,
T entity,
DBObject dbObj,
Object idValue,
WriteConcern wc,
MappedClass mc) |
<T> UpdateResults |
update(Key<T> key,
UpdateOperations<T> ops)
updates the entity with the operations; this is an atomic operation
|
<T> UpdateResults |
update(Query<T> query,
UpdateOperations<T> ops)
updates all entities found with the operations; this is an atomic operation per entity
|
<T> UpdateResults |
update(Query<T> query,
UpdateOperations<T> ops,
boolean createIfMissing)
updates all entities found with the operations, if nothing is found insert the update as an entity if "createIfMissing" is true; this
is an atomic operation per entity
|
<T> UpdateResults |
update(Query<T> query,
UpdateOperations<T> ops,
boolean createIfMissing,
WriteConcern wc) |
<T> UpdateResults |
update(T ent,
UpdateOperations<T> ops)
updates the entity with the operations; this is an atomic operation
|
<T> UpdateResults |
updateFirst(Query<T> query,
T entity,
boolean createIfMissing)
updates the first entity found with the operations, if nothing is found insert the update as an entity if "createIfMissing" is true;
this is an atomic operation per entity
|
<T> UpdateResults |
updateFirst(Query<T> query,
UpdateOperations<T> ops)
updates the first entity found with the operations; this is an atomic operation
|
<T> UpdateResults |
updateFirst(Query<T> query,
UpdateOperations<T> ops,
boolean createIfMissing)
updates the first entity found with the operations, if nothing is found insert the update as an entity if "createIfMissing" is true;
this is an atomic operation per entity
|
<T> UpdateResults |
updateFirst(Query<T> query,
UpdateOperations<T> ops,
boolean createIfMissing,
WriteConcern wc) |
public DatastoreImpl(Morphia morphia, Mapper mapper, MongoClient mongoClient, String dbName)
morphia - the Morphia instancemapper - an initialised MappermongoClient - the connection to the MongoDB instancedbName - the name of the database for this data store.public DatastoreImpl(Morphia morphia, MongoClient mongoClient, String dbName)
morphia - the Morphia instancemongoClient - the connection to the MongoDB instancedbName - the name of the database for this data store.public static long nextValue(Long oldVersion)
public DatastoreImpl copy(String database)
public <T,V> DBRef createRef(Class<T> clazz, V id)
AdvancedDatastorecreateRef in interface AdvancedDatastorepublic <T> DBRef createRef(T entity)
AdvancedDatastorecreateRef in interface AdvancedDatastore@Deprecated protected Object getId(Object entity)
@Deprecated public <T> Key<T> getKey(T entity)
DatastoreDBRefpublic <T,V> WriteResult delete(String kind, Class<T> clazz, V id)
AdvancedDatastoreid, from the collection with the name in the kind param.
Validates the id, checking it's the correct type for an ID for entities of type T. The entity type clazz is
used only for validation, not for filtering, therefore if you have entities of different types in the same collection (kind),
this method will delete any entity with the given id, regardless of its type.delete in interface AdvancedDatastoreT - the entity typeV - is the type of the ID, for example ObjectIdkind - the collection nameclazz - the Class of the entity to deleteid - the value of the IDpublic <T,V> WriteResult delete(String kind, Class<T> clazz, V id, WriteConcern wc)
AdvancedDatastoreid, from the collection with the name in the kind param.
Validates the id, checking it's the correct type for an ID for entities of type T. The entity type clazz is
used only for validation, not for filtering, therefore if you have entities of different types in the same collection (kind),
this method will delete any entity with the given id, regardless of its type.delete in interface AdvancedDatastoreT - the entity typeV - is the type of the ID, for example ObjectIdkind - the collection nameclazz - the Class of the entity to deleteid - the value of the IDwc - the WriteConcern for this operationpublic <T,V> WriteResult delete(Class<T> clazz, V id)
Datastorepublic <T,V> WriteResult delete(Class<T> clazz, V id, WriteConcern wc)
public <T,V> WriteResult delete(Class<T> clazz, Iterable<V> ids)
Datastorepublic <T> WriteResult delete(T entity)
Datastorepublic <T> WriteResult delete(T entity, WriteConcern wc)
Datastorepublic <T> WriteResult delete(Query<T> query)
Datastorepublic <T> WriteResult delete(Query<T> query, WriteConcern wc)
Datastorepublic <T> void ensureIndex(Class<T> type, String fields)
DatastoreensureIndex in interface Datastorepublic <T> void ensureIndex(Class<T> clazz, String name, String fields, boolean unique, boolean dropDupsOnCreate)
DatastoreensureIndex in interface Datastoreprotected <T> void ensureIndex(Class<T> clazz, String name, BasicDBObject fields, boolean unique, boolean dropDupsOnCreate, boolean background, boolean sparse, int expireAfterSeconds)
public <T> void ensureIndex(String collName, Class<T> type, String fields)
AdvancedDatastoreensureIndex in interface AdvancedDatastorepublic <T> void ensureIndex(String collName, Class<T> clazz, String name, String fields, boolean unique, boolean dropDupsOnCreate)
AdvancedDatastoreensureIndex in interface AdvancedDatastoreprotected void ensureIndex(DBCollection dbColl, String name, BasicDBObject fields, boolean unique, boolean dropDupsOnCreate, boolean background, boolean sparse, int expireAfterSeconds)
protected void ensureIndexes(MappedClass mc, boolean background)
protected void ensureIndexes(MappedClass mc, boolean background, List<MappedClass> parentMCs, List<MappedField> parentMFs)
protected void ensureIndexes(String collName, MappedClass mc, boolean background)
protected void ensureIndexes(DBCollection dbColl, MappedClass mc, boolean background, List<MappedClass> parentMCs, List<MappedField> parentMFs)
protected void ensureIndex(MappedClass mc, DBCollection dbColl, Field[] fields, IndexOptions options)
public <T> void ensureIndexes(Class<T> clazz)
Datastore@Indexed, @Indexes)ensureIndexes in interface Datastorepublic <T> void ensureIndexes(Class<T> clazz, boolean background)
Datastore@Indexed, @Indexes), possibly in the
backgroundensureIndexes in interface Datastorepublic void ensureIndexes()
Datastore@Indexed, @Indexes)ensureIndexes in interface Datastorepublic void ensureIndexes(boolean background)
Datastore@Indexed, @Indexes), possibly in the
backgroundensureIndexes in interface Datastorepublic <T> void ensureIndexes(String collName, Class<T> clazz)
AdvancedDatastore@Indexed, @Indexes) on the given collection
name.ensureIndexes in interface AdvancedDatastorepublic <T> void ensureIndexes(String collName, Class<T> clazz, boolean background)
AdvancedDatastore@Indexed, @Indexes) on the given collection
name, possibly in the backgroundensureIndexes in interface AdvancedDatastorepublic void ensureCaps()
DatastoreEntity(s)ensureCaps in interface Datastorepublic <T> Query<T> queryByExample(T ex)
DatastorequeryByExample in interface Datastorepublic <T> Query<T> queryByExample(String kind, T ex)
AdvancedDatastorequeryByExample in interface AdvancedDatastorepublic AggregationPipeline createAggregation(Class source)
DBCollection)createAggregation in interface Datastorepublic <T> Query<T> createQuery(Class<T> type)
DatastoreDBCollection)createQuery in interface Datastorepublic <T> Query<T> createQuery(String kind, Class<T> type)
createQuery in interface AdvancedDatastorekind - the name of the collection that should be queriedtype - the class of objects to be returnedpublic <T> Query<T> createQuery(Class<T> type, DBObject q)
createQuery in interface AdvancedDatastoretype - the class of objects to be returnedq - the query which will be passed to a QueryFactorypublic <T> Query<T> createQuery(String kind, Class<T> type, DBObject q)
createQuery in interface AdvancedDatastorepublic <T> Query<T> find(String kind, Class<T> clazz)
find in interface AdvancedDatastorepublic <T> Query<T> find(Class<T> clazz)
Datastorepublic <T,V> Query<T> find(Class<T> clazz, String property, V value)
DatastoreFind all instances by collectionName, and filter property.
This is the same as: find(clazzOrEntity).filter
(property, value);
public <T,V> Query<T> find(String kind, Class<T> clazz, String property, V value, int offset, int size)
find in interface AdvancedDatastorepublic <T,V> Query<T> find(String kind, Class<T> clazz, String property, V value, int offset, int size, boolean validate)
public <T,V> Query<T> find(Class<T> clazz, String property, V value, int offset, int size)
DatastoreFind all instances by collectionName, and filter property.
This is the same as: find(clazzOrEntity).filter
(property, value).offset(offset).limit(size);
public <T> T get(Class<T> clazz, DBRef ref)
AdvancedDatastoreget in interface AdvancedDatastorepublic <T,V> Query<T> get(Class<T> clazz, Iterable<V> ids)
Datastorefind("_id in", ids)public <T> List<T> getByKeys(Iterable<Key<T>> keys)
Datastorefind("_id in", ids)public <T> List<T> getByKeys(Class<T> clazz, Iterable<Key<T>> keys)
Datastorefind("_id in", ids)public <T,V> T get(String kind, Class<T> clazz, V id)
get in interface AdvancedDatastorepublic <T,V> T get(Class<T> clazz, V id)
Datastorefind("_id ", id)public <T> T getByKey(Class<T> clazz, Key<T> key)
Datastorepublic <T> T get(T entity)
Datastorepublic Key<?> exists(Object entityOrKey)
Datastorepublic Key<?> exists(Object entityOrKey, ReadPreference readPreference)
exists in interface AdvancedDatastorereadPreference - Uses the supplied ReadPreference for the check. If readPreference is null the preference is taken from the
annotation or uses the default preference.Datastore.exists(Object)public DBCollection getCollection(Class clazz)
getCollection in interface Datastorepublic DBCollection getCollection(Object obj)
protected DBCollection getCollection(String kind)
public <T> long getCount(T entity)
DatastoreDBCollection)public <T> long getCount(Class<T> clazz)
DatastoreDBCollection)public long getCount(String kind)
AdvancedDatastoregetCount in interface AdvancedDatastorepublic <T> long getCount(Query<T> query)
Datastorequery.countAll()public MongoClient getMongo()
Datastorepublic Mapper getMapper()
public <T> Iterable<Key<T>> insert(Iterable<T> entities, WriteConcern wc)
insert in interface AdvancedDatastorepublic <T> Iterable<Key<T>> insert(String kind, Iterable<T> entities)
insert in interface AdvancedDatastorepublic <T> Iterable<Key<T>> insert(String kind, Iterable<T> entities, WriteConcern wc)
insert in interface AdvancedDatastorepublic <T> Iterable<Key<T>> insert(T... entities)
insert in interface AdvancedDatastorepublic <T> Key<T> insert(T entity)
insert in interface AdvancedDatastorepublic <T> Key<T> insert(T entity, WriteConcern wc)
insert in interface AdvancedDatastorepublic <T> Key<T> insert(String kind, T entity)
insert in interface AdvancedDatastorepublic <T> Key<T> insert(String kind, T entity, WriteConcern wc)
protected <T> Key<T> insert(DBCollection dbColl, T entity, WriteConcern wc)
public <T> Iterable<Key<T>> save(Iterable<T> entities)
Datastorepublic <T> Iterable<Key<T>> save(Iterable<T> entities, WriteConcern wc)
Datastorepublic <T> Iterable<Key<T>> save(T... entities)
Datastoreprotected <T> Key<T> save(DBCollection dbColl, T entity, WriteConcern wc)
protected <T> WriteResult tryVersionedUpdate(DBCollection dbColl, T entity, DBObject dbObj, Object idValue, WriteConcern wc, MappedClass mc)
public <T> Key<T> save(T entity)
Datastorepublic <T> Key<T> save(String kind, T entity)
save in interface AdvancedDatastorepublic <T> Key<T> save(String kind, T entity, WriteConcern wc)
save in interface AdvancedDatastorepublic <T> Key<T> save(T entity, WriteConcern wc)
Datastorepublic <T> UpdateOperations<T> createUpdateOperations(Class<T> clazz)
DatastorecreateUpdateOperations in interface Datastorepublic <T> UpdateOperations<T> createUpdateOperations(Class<T> kind, DBObject ops)
createUpdateOperations in interface AdvancedDatastorepublic <T> UpdateResults update(Query<T> query, UpdateOperations<T> ops, boolean createIfMissing)
Datastorepublic <T> UpdateResults update(Query<T> query, UpdateOperations<T> ops, boolean createIfMissing, WriteConcern wc)
public <T> UpdateResults update(T ent, UpdateOperations<T> ops)
Datastorepublic <T> UpdateResults update(Key<T> key, UpdateOperations<T> ops)
Datastorepublic <T> UpdateResults update(Query<T> query, UpdateOperations<T> ops)
Datastorepublic <T> UpdateResults updateFirst(Query<T> query, UpdateOperations<T> ops)
DatastoreupdateFirst in interface Datastorepublic <T> UpdateResults updateFirst(Query<T> query, UpdateOperations<T> ops, boolean createIfMissing)
DatastoreupdateFirst in interface Datastorepublic <T> UpdateResults updateFirst(Query<T> query, UpdateOperations<T> ops, boolean createIfMissing, WriteConcern wc)
updateFirst in interface Datastorepublic <T> UpdateResults updateFirst(Query<T> query, T entity, boolean createIfMissing)
DatastoreupdateFirst in interface Datastorepublic <T> Key<T> merge(T entity)
Datastorepublic <T> Key<T> merge(T entity, WriteConcern wc)
Datastorepublic <T> T findAndDelete(Query<T> qi)
DatastorefindAndDelete in interface Datastorepublic <T> T findAndModify(Query<T> q, UpdateOperations<T> ops)
DatastorefindAndModify in interface Datastorepublic <T> T findAndModify(Query<T> query, UpdateOperations<T> ops, boolean oldVersion)
DatastorefindAndModify in interface Datastorequery - the query to find the Entity with; You are not allowed to offset/skip in the query.oldVersion - indicated the old version of the Entity should be returnedpublic <T> T findAndModify(Query<T> qi, UpdateOperations<T> ops, boolean oldVersion, boolean createIfMissing)
DatastorefindAndModify in interface Datastoreqi - the query to find the Entity with; You are not allowed to offset/skip in the query.oldVersion - indicated the old version of the Entity should be returnedcreateIfMissing - if the query returns no results, then a new object will be created (sets upsert=true)public <T> MapreduceResults<T> mapReduce(MapreduceType type, Query query, Class<T> outputType, MapReduceCommand baseCommand)
DatastoremapReduce in interface DatastoreT - The type of resulting datatype - MapreduceTypequery - The query (only the criteria, limit and sort will be used)outputType - The type of resulting data; inline is not working yetbaseCommand - The base command to fill in and send to the serverpublic <T> MapreduceResults<T> mapReduce(MapreduceType type, Query query, String map, String reduce, String finalize, Map<String,Object> scopeFields, Class<T> outputType)
DatastoremapReduce in interface DatastoreT - The type of resulting datatype - MapreduceTypequery - The query (only the criteria, limit and sort will be used)map - The map function, in javascript, as a stringreduce - The reduce function, in javascript, as a stringfinalize - The finalize function, in javascript, as a string; can be nullscopeFields - Each map entry will be a global variable in all the functions; can be nulloutputType - The type of resulting data; inline is not working yetpublic WriteConcern getWriteConcern(Object clazzOrEntity)
public WriteConcern getDefaultWriteConcern()
getDefaultWriteConcern in interface Datastorepublic void setDefaultWriteConcern(WriteConcern wc)
setDefaultWriteConcern in interface Datastorepublic DBDecoderFactory setDecoderFact(DBDecoderFactory fact)
setDecoderFact in interface AdvancedDatastorepublic DBDecoderFactory getDecoderFact()
getDecoderFact in interface AdvancedDatastorepublic void setQueryFactory(QueryFactory queryFactory)
DatastoreQueryFactory with the given value.setQueryFactory in interface DatastoreQueryFactorypublic QueryFactory getQueryFactory()
DatastoreQueryFactory.getQueryFactory in interface DatastoreQueryFactory