Schnittstelle MorphiumWriter
- Alle bekannten Implementierungsklassen:
AsyncWriterImpl, BufferedMorphiumWriterImpl, MorphiumWriterImpl
public interface MorphiumWriter
User: Stephan Bösebeck
Date: 30.08.12
Time: 14:39
Interface for all morphium write accesses. Override for own use and set to MorphiumConfig
- Siehe auch:
-
Methodenübersicht
Modifikator und TypMethodeBeschreibungvoidclose()information about closing of morphium and all connections<T> voidcreateIndex(Class<T> cls, String collection, IndexDescription idx, AsyncOperationCallback<T> callback) <T> voiddropCollection(Class<T> cls, String collection, AsyncOperationCallback<T> callback) explainRemove(ExplainCommand.ExplainVerbosity verbosity, Query<T> q) explainRemove(ExplainCommand.ExplainVerbosity verbosity, T o, String Collection) voidflush()voidinc(Query<T> query, String field, Number amount, boolean insertIfNotExist, boolean multiple, AsyncOperationCallback<T> callback) inc(Query<T> query, Map<String, Number> fieldsToInc, boolean insertIfNotExist, boolean multiple, AsyncOperationCallback<T> callback) <T> voidinc(T toInc, String collection, String field, Number amount, AsyncOperationCallback<T> callback) Increases a value in an existing mongo collection entry - no reading necessary.<T> voidinsert(List<T> o, AsyncOperationCallback<T> callback) <T> voidinsert(List<T> lst, String collectionName, AsyncOperationCallback<T> callback) <T> voidinsert(T o, String collection, AsyncOperationCallback<T> callback) <T> voidpop(T obj, String collection, String field, boolean first, AsyncOperationCallback<T> callback) pushPull(MorphiumStorageListener.UpdateTypes type, Query<T> query, String field, Object value, boolean insertIfNotExist, boolean multiple, AsyncOperationCallback<T> callback) pushPullAll(MorphiumStorageListener.UpdateTypes type, Query<T> query, String field, List<?> value, boolean insertIfNotExist, boolean multiple, AsyncOperationCallback<T> callback) remove(Query<T> q, boolean multiple, AsyncOperationCallback<T> callback) remove(Query<T> q, AsyncOperationCallback<T> callback) deletes all objects matching the given query<T> voidremove(List<T> lst, AsyncOperationCallback<T> callback) <T> voidremove(T o, String collection, AsyncOperationCallback<T> callback) set(Query<T> query, Map<String, Object> values, boolean insertIfNotExist, boolean multiple, AsyncOperationCallback<T> callback) will change an entry in mongodb-collection corresponding to given class object if query is too complex, upsert might not work!<T> voidset(T toSet, String collection, Map<String, Object> values, boolean upsert, AsyncOperationCallback<T> callback) changes an object in DB AND in Memory... the Object toSet WILL be modified!voidsetMaximumQueingTries(int n) voidvoidsetPauseBetweenTries(int p) <T> voidstore(List<T> lst, AsyncOperationCallback<T> callback) stores the given list of objects, should be entities or embedded.<T> voidstore(List<T> lst, String collectionName, AsyncOperationCallback<T> callback) <T> voidstore(T o, String collection, AsyncOperationCallback<T> callback) Stores the object, should be an entityunset(Query<T> query, AsyncOperationCallback<T> callback, boolean multiple, Enum... fields) unset(Query<T> query, AsyncOperationCallback<T> callback, boolean multiple, String... fields) unset(Query<T> query, String field, boolean multiple, AsyncOperationCallback<T> callback) <T> voidunset(T toSet, String collection, String field, AsyncOperationCallback<T> callback) Un-setting a value in an existing mongo collection entry - no reading necessary.<T> voidupdateUsingFields(T ent, String collection, AsyncOperationCallback<T> callback, String... fields) update an object using fields specifiedint
-
Methodendetails
-
store
Stores the object, should be an entity- Parameter:
o- - entity
-
insert
-
store
stores the given list of objects, should be entities or embedded.- Parameter:
lst- - to store
-
insert
-
store
-
insert
-
updateUsingFields
<T> void updateUsingFields(T ent, String collection, AsyncOperationCallback<T> callback, String... fields) update an object using fields specified- Parameter:
ent- entityfields- - fields
-
set
<T> void set(T toSet, String collection, Map<String, Object> values, boolean upsert, AsyncOperationCallback<T> callback) changes an object in DB AND in Memory... the Object toSet WILL be modified!- Parameter:
toSet- entity to set values in both in mongo and in memoryvalues- : contains name/values to set to the given object!
-
set
<T> Map<String,Object> set(Query<T> query, Map<String, Object> values, boolean insertIfNotExist, boolean multiple, AsyncOperationCallback<T> callback) will change an entry in mongodb-collection corresponding to given class object if query is too complex, upsert might not work! Upsert should consist of single and-queries, which will be used to generate the object to create, unless it already exists. look at Mongodb-query documentation as well- Parameter:
query- - query to specify which objects should be setvalues- - map fieldName->Value, which values are to be set!insertIfNotExist- - insert, if it does not exist (query needs to be simple!)multiple- - update several documents, if false, only first hit will be updated
-
inc
-
inc
<T> void inc(T toInc, String collection, String field, Number amount, AsyncOperationCallback<T> callback) Increases a value in an existing mongo collection entry - no reading necessary. Object is altered in place db.collection.update({"_id":toInc.id},{$inc:{field:amount}} attention: this alteres the given object toSet in a similar way- Parameter:
toInc- : object to set the value in (or better - the corresponding entry in mongo)field- : the field to changeamount- : the value to set
-
setMorphium
-
remove
-
remove
-
explainRemove
<T> Map<String,Object> explainRemove(ExplainCommand.ExplainVerbosity verbosity, T o, String Collection) -
remove
-
remove
deletes all objects matching the given query- Parameter:
q- the query
-
explainRemove
-
pushPull
<T> Map<String,Object> pushPull(MorphiumStorageListener.UpdateTypes type, Query<T> query, String field, Object value, boolean insertIfNotExist, boolean multiple, AsyncOperationCallback<T> callback) -
pushPullAll
<T> Map<String,Object> pushPullAll(MorphiumStorageListener.UpdateTypes type, Query<T> query, String field, List<?> value, boolean insertIfNotExist, boolean multiple, AsyncOperationCallback<T> callback) -
unset
Un-setting a value in an existing mongo collection entry - no reading necessary. Object is altered in place db.collection.update({"_id":toSet.id},{$unset:{field:1}} attention: this alteres the given object toSet in a similar way- Parameter:
toSet- : object to set the value in (or better - the corresponding entry in mongo)field- : field to remove from document
-
pop
<T> void pop(T obj, String collection, String field, boolean first, AsyncOperationCallback<T> callback) -
unset
-
unset
-
unset
-
dropCollection
-
createIndex
<T> void createIndex(Class<T> cls, String collection, IndexDescription idx, AsyncOperationCallback<T> callback) -
writeBufferCount
int writeBufferCount() -
flush
void flush() -
flush
-
setMaximumQueingTries
void setMaximumQueingTries(int n) -
setPauseBetweenTries
void setPauseBetweenTries(int p) -
inc
-
close
void close()information about closing of morphium and all connections
-