public class DatastoreImpl extends Object implements AdvancedDatastore
Constructor and Description |
---|
DatastoreImpl(Morphia morphia,
Mapper mapper,
com.mongodb.MongoClient mongoClient,
String dbName)
Create a new DatastoreImpl
|
DatastoreImpl(Morphia morphia,
com.mongodb.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,
com.mongodb.DBObject q) |
<T> Query<T> |
createQuery(String kind,
Class<T> type) |
<T> Query<T> |
createQuery(String kind,
Class<T> type,
com.mongodb.DBObject q) |
<T,V> com.mongodb.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> com.mongodb.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,
com.mongodb.DBObject ops) |
<T,V> com.mongodb.WriteResult |
delete(Class<T> clazz,
Iterable<V> ids)
Deletes the given entities (by id)
|
<T,V> com.mongodb.WriteResult |
delete(Class<T> clazz,
V id)
Deletes the given entity (by id)
|
<T,V> com.mongodb.WriteResult |
delete(Class<T> clazz,
V id,
com.mongodb.WriteConcern wc) |
<T> com.mongodb.WriteResult |
delete(Query<T> query)
Deletes the given entities based on the query
|
<T> com.mongodb.WriteResult |
delete(Query<T> query,
com.mongodb.WriteConcern wc)
Deletes the given entities based on the query, with the WriteConcern
|
<T,V> com.mongodb.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> com.mongodb.WriteResult |
delete(String kind,
Class<T> clazz,
V id,
com.mongodb.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> com.mongodb.WriteResult |
delete(T entity)
Deletes the given entity (by @Id)
|
<T> com.mongodb.WriteResult |
delete(T entity,
com.mongodb.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})
|
<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})
|
<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 |
<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 |
Key<?> |
exists(Object entityOrKey)
Does a query to check if the keyOrEntity exists in mongodb
|
Key<?> |
exists(Object entityOrKey,
com.mongodb.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,
com.mongodb.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) |
com.mongodb.DBCollection |
getCollection(Class clazz) |
com.mongodb.DBCollection |
getCollection(Object obj) |
<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 ) |
com.mongodb.DB |
getDB() |
com.mongodb.DBDecoderFactory |
getDecoderFact() |
com.mongodb.WriteConcern |
getDefaultWriteConcern() |
<T> Key<T> |
getKey(T entity)
Deprecated.
|
Mapper |
getMapper() |
com.mongodb.MongoClient |
getMongo()
Get the underlying MongoClient that allows connection to the MongoDB instance being used.
|
QueryFactory |
getQueryFactory()
Returns the current
QueryFactory . |
com.mongodb.WriteConcern |
getWriteConcern(Object clazzOrEntity)
Gets the write concern for entity or returns the default write concern for this datastore
|
<T> Iterable<Key<T>> |
insert(Iterable<T> entities) |
<T> Iterable<Key<T>> |
insert(Iterable<T> entities,
com.mongodb.WriteConcern wc) |
<T> Iterable<Key<T>> |
insert(String kind,
Iterable<T> entities) |
<T> Iterable<Key<T>> |
insert(String kind,
Iterable<T> entities,
com.mongodb.WriteConcern wc) |
<T> Key<T> |
insert(String kind,
T entity) |
<T> Key<T> |
insert(String kind,
T entity,
com.mongodb.WriteConcern wc) |
<T> Iterable<Key<T>> |
insert(T... entities) |
<T> Key<T> |
insert(T entity) |
<T> Key<T> |
insert(T entity,
com.mongodb.WriteConcern wc) |
<T> MapreduceResults<T> |
mapReduce(MapreduceType type,
Query query,
Class<T> outputType,
com.mongodb.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,
com.mongodb.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
|
<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,
com.mongodb.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,
com.mongodb.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,
com.mongodb.WriteConcern wc)
Saves the entity (Object) and updates the @Id field, with the WriteConcern
|
com.mongodb.DBDecoderFactory |
setDecoderFact(com.mongodb.DBDecoderFactory fact) |
void |
setDefaultWriteConcern(com.mongodb.WriteConcern wc) |
void |
setQueryFactory(QueryFactory queryFactory)
Replaces the current
QueryFactory with the given value. |
<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,
com.mongodb.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,
com.mongodb.WriteConcern wc) |
public DatastoreImpl(Morphia morphia, Mapper mapper, com.mongodb.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 static long nextValue(Long oldVersion)
public DatastoreImpl copy(String database)
public <T,V> com.mongodb.DBRef createRef(Class<T> clazz, V id)
AdvancedDatastore
createRef
in interface AdvancedDatastore
public <T> com.mongodb.DBRef createRef(T entity)
AdvancedDatastore
createRef
in interface AdvancedDatastore
@Deprecated public <T> Key<T> getKey(T entity)
Datastore
DBRef
public <T,V> com.mongodb.WriteResult delete(String kind, Class<T> clazz, V id)
AdvancedDatastore
id
, 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 AdvancedDatastore
T
- 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> com.mongodb.WriteResult delete(String kind, Class<T> clazz, V id, com.mongodb.WriteConcern wc)
AdvancedDatastore
id
, 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 AdvancedDatastore
T
- 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> com.mongodb.WriteResult delete(Class<T> clazz, V id)
Datastore
public <T,V> com.mongodb.WriteResult delete(Class<T> clazz, V id, com.mongodb.WriteConcern wc)
public <T,V> com.mongodb.WriteResult delete(Class<T> clazz, Iterable<V> ids)
Datastore
public <T> com.mongodb.WriteResult delete(T entity)
Datastore
public <T> com.mongodb.WriteResult delete(T entity, com.mongodb.WriteConcern wc)
Datastore
public <T> com.mongodb.WriteResult delete(Query<T> query)
Datastore
public <T> com.mongodb.WriteResult delete(Query<T> query, com.mongodb.WriteConcern wc)
Datastore
public <T> void ensureIndex(Class<T> type, String fields)
Datastore
ensureIndex
in interface Datastore
public <T> void ensureIndex(Class<T> clazz, String name, String fields, boolean unique, boolean dropDupsOnCreate)
Datastore
ensureIndex
in interface Datastore
public <T> void ensureIndex(String collName, Class<T> type, String fields)
AdvancedDatastore
ensureIndex
in interface AdvancedDatastore
public <T> void ensureIndex(String collName, Class<T> clazz, String name, String fields, boolean unique, boolean dropDupsOnCreate)
AdvancedDatastore
ensureIndex
in interface AdvancedDatastore
public <T> void ensureIndexes(Class<T> clazz)
Datastore
@Indexed, @Indexes)
ensureIndexes
in interface Datastore
public <T> void ensureIndexes(Class<T> clazz, boolean background)
Datastore
@Indexed, @Indexes)
, possibly in the
backgroundensureIndexes
in interface Datastore
public void ensureIndexes()
Datastore
@Indexed, @Indexes)
ensureIndexes
in interface Datastore
public void ensureIndexes(boolean background)
Datastore
@Indexed, @Indexes)
, possibly in the
backgroundensureIndexes
in interface Datastore
public <T> void ensureIndexes(String collName, Class<T> clazz)
AdvancedDatastore
@Indexed, @Indexes)
on the given collection
name.ensureIndexes
in interface AdvancedDatastore
public <T> void ensureIndexes(String collName, Class<T> clazz, boolean background)
AdvancedDatastore
@Indexed, @Indexes)
on the given collection
name, possibly in the backgroundensureIndexes
in interface AdvancedDatastore
public void ensureCaps()
Datastore
Entity
(s)ensureCaps
in interface Datastore
public <T> Query<T> queryByExample(T ex)
Datastore
queryByExample
in interface Datastore
public <T> Query<T> queryByExample(String kind, T ex)
AdvancedDatastore
queryByExample
in interface AdvancedDatastore
public AggregationPipeline createAggregation(Class source)
DBCollection
)createAggregation
in interface Datastore
public <T> Query<T> createQuery(Class<T> type)
Datastore
DBCollection
)createQuery
in interface Datastore
public <T> Query<T> createQuery(String kind, Class<T> type)
createQuery
in interface AdvancedDatastore
kind
- the name of the collection that should be queriedtype
- the class of objects to be returnedpublic <T> Query<T> createQuery(Class<T> type, com.mongodb.DBObject q)
createQuery
in interface AdvancedDatastore
type
- the class of objects to be returnedq
- the query which will be passed to a QueryFactory
public <T> Query<T> createQuery(String kind, Class<T> type, com.mongodb.DBObject q)
createQuery
in interface AdvancedDatastore
public <T> Query<T> find(String kind, Class<T> clazz)
find
in interface AdvancedDatastore
public <T> Query<T> find(Class<T> clazz)
Datastore
public <T,V> Query<T> find(Class<T> clazz, String property, V value)
Datastore
Find 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 AdvancedDatastore
public <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)
Datastore
Find 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, com.mongodb.DBRef ref)
AdvancedDatastore
get
in interface AdvancedDatastore
public <T,V> Query<T> get(Class<T> clazz, Iterable<V> ids)
Datastore
find("_id in", ids)
public <T> List<T> getByKeys(Iterable<Key<T>> keys)
Datastore
find("_id in", ids)
public <T> List<T> getByKeys(Class<T> clazz, Iterable<Key<T>> keys)
Datastore
find("_id in", ids)
public <T,V> T get(String kind, Class<T> clazz, V id)
get
in interface AdvancedDatastore
public <T,V> T get(Class<T> clazz, V id)
Datastore
find("_id ", id)
public <T> T getByKey(Class<T> clazz, Key<T> key)
Datastore
public <T> T get(T entity)
Datastore
public Key<?> exists(Object entityOrKey)
Datastore
public Key<?> exists(Object entityOrKey, com.mongodb.ReadPreference readPreference)
exists
in interface AdvancedDatastore
readPreference
- 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 com.mongodb.DBCollection getCollection(Class clazz)
getCollection
in interface Datastore
public com.mongodb.DBCollection getCollection(Object obj)
public <T> long getCount(T entity)
Datastore
DBCollection
)public <T> long getCount(Class<T> clazz)
Datastore
DBCollection
)public long getCount(String kind)
AdvancedDatastore
getCount
in interface AdvancedDatastore
public <T> long getCount(Query<T> query)
Datastore
query.countAll()
public com.mongodb.MongoClient getMongo()
Datastore
public Mapper getMapper()
public <T> Iterable<Key<T>> insert(Iterable<T> entities, com.mongodb.WriteConcern wc)
insert
in interface AdvancedDatastore
public <T> Iterable<Key<T>> insert(String kind, Iterable<T> entities)
insert
in interface AdvancedDatastore
public <T> Iterable<Key<T>> insert(String kind, Iterable<T> entities, com.mongodb.WriteConcern wc)
insert
in interface AdvancedDatastore
public <T> Iterable<Key<T>> insert(T... entities)
insert
in interface AdvancedDatastore
public <T> Key<T> insert(T entity)
insert
in interface AdvancedDatastore
public <T> Key<T> insert(T entity, com.mongodb.WriteConcern wc)
insert
in interface AdvancedDatastore
public <T> Key<T> insert(String kind, T entity)
insert
in interface AdvancedDatastore
public <T> Iterable<Key<T>> save(Iterable<T> entities)
Datastore
public <T> Iterable<Key<T>> save(Iterable<T> entities, com.mongodb.WriteConcern wc)
Datastore
public <T> Iterable<Key<T>> save(T... entities)
Datastore
public <T> Key<T> save(T entity)
Datastore
public <T> Key<T> save(String kind, T entity)
save
in interface AdvancedDatastore
public <T> Key<T> save(String kind, T entity, com.mongodb.WriteConcern wc)
save
in interface AdvancedDatastore
public <T> Key<T> save(T entity, com.mongodb.WriteConcern wc)
Datastore
public <T> UpdateOperations<T> createUpdateOperations(Class<T> clazz)
Datastore
createUpdateOperations
in interface Datastore
public <T> UpdateOperations<T> createUpdateOperations(Class<T> kind, com.mongodb.DBObject ops)
createUpdateOperations
in interface AdvancedDatastore
public <T> UpdateResults update(Query<T> query, UpdateOperations<T> ops, boolean createIfMissing)
Datastore
public <T> UpdateResults update(Query<T> query, UpdateOperations<T> ops, boolean createIfMissing, com.mongodb.WriteConcern wc)
public <T> UpdateResults update(T ent, UpdateOperations<T> ops)
Datastore
public <T> UpdateResults update(Key<T> key, UpdateOperations<T> ops)
Datastore
public <T> UpdateResults update(Query<T> query, UpdateOperations<T> ops)
Datastore
public <T> UpdateResults updateFirst(Query<T> query, UpdateOperations<T> ops)
Datastore
updateFirst
in interface Datastore
public <T> UpdateResults updateFirst(Query<T> query, UpdateOperations<T> ops, boolean createIfMissing)
Datastore
updateFirst
in interface Datastore
public <T> UpdateResults updateFirst(Query<T> query, UpdateOperations<T> ops, boolean createIfMissing, com.mongodb.WriteConcern wc)
updateFirst
in interface Datastore
public <T> UpdateResults updateFirst(Query<T> query, T entity, boolean createIfMissing)
Datastore
updateFirst
in interface Datastore
public <T> Key<T> merge(T entity)
Datastore
public <T> Key<T> merge(T entity, com.mongodb.WriteConcern wc)
Datastore
public <T> T findAndDelete(Query<T> qi)
Datastore
findAndDelete
in interface Datastore
public <T> T findAndModify(Query<T> q, UpdateOperations<T> ops)
Datastore
findAndModify
in interface Datastore
public <T> T findAndModify(Query<T> query, UpdateOperations<T> ops, boolean oldVersion)
Datastore
findAndModify
in interface Datastore
query
- 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)
Datastore
findAndModify
in interface Datastore
qi
- 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, com.mongodb.MapReduceCommand baseCommand)
Datastore
mapReduce
in interface Datastore
T
- 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)
Datastore
mapReduce
in interface Datastore
T
- 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 com.mongodb.WriteConcern getWriteConcern(Object clazzOrEntity)
public com.mongodb.WriteConcern getDefaultWriteConcern()
getDefaultWriteConcern
in interface Datastore
public void setDefaultWriteConcern(com.mongodb.WriteConcern wc)
setDefaultWriteConcern
in interface Datastore
public com.mongodb.DBDecoderFactory setDecoderFact(com.mongodb.DBDecoderFactory fact)
setDecoderFact
in interface AdvancedDatastore
public com.mongodb.DBDecoderFactory getDecoderFact()
getDecoderFact
in interface AdvancedDatastore
public void setQueryFactory(QueryFactory queryFactory)
Datastore
QueryFactory
with the given value.setQueryFactory
in interface Datastore
QueryFactory
public QueryFactory getQueryFactory()
Datastore
QueryFactory
.getQueryFactory
in interface Datastore
QueryFactory
Copyright © 2016. All rights reserved.