public class MongoDBVCollection extends java.lang.Object implements VCollection
VCollection
for MongoDBModifier and Type | Field and Description |
---|---|
protected static java.lang.String |
OID
The ID unique for each new object, regardless if it is really new
or a new copy of an already existing object
|
protected static java.lang.String |
UID
The attribute for the unique ID
|
Constructor and Description |
---|
MongoDBVCollection(com.mongodb.DBCollection delegate,
MongoDBVBranch branch,
VCounter counter)
Creates a new MongoDBVCollection.
|
Modifier and Type | Method and Description |
---|---|
protected VCursor |
createCursor(com.mongodb.DBCursor delegate,
Filter<com.mongodb.DBObject> filter)
Creates a new cursor.
|
void |
delete(long uid)
Deletes the object with the given UID from the collection (if it exists)
|
void |
delete(java.util.Map<java.lang.String,java.lang.Object> example)
Deletes all objects from the collection that match the given example object
|
VCursor |
find() |
VCursor |
find(java.util.Map<java.lang.String,java.lang.Object> example)
Find by example.
|
VCursor |
find(java.util.Map<java.lang.String,java.lang.Object> example,
java.lang.String... fields)
Find by example.
|
java.util.Map<java.lang.String,java.lang.Object> |
findOne(java.util.Map<java.lang.String,java.lang.Object> example)
Finds an object that matches the given example
|
protected VCounter |
getCounter() |
java.lang.String |
getName() |
void |
insert(java.util.Map<java.lang.String,java.lang.Object> obj)
Inserts a new object to the collection.
|
protected static final java.lang.String UID
protected static final java.lang.String OID
public MongoDBVCollection(com.mongodb.DBCollection delegate, MongoDBVBranch branch, VCounter counter)
delegate
- the actual MongoDB collectionbranch
- the branch currently checked outcounter
- a counter to generate unique IDspublic void insert(java.util.Map<java.lang.String,java.lang.Object> obj)
VCollection
uid
attribute.insert
in interface VCollection
obj
- the object to add to the collectionpublic void delete(long uid)
VCollection
delete
in interface VCollection
uid
- the UID of the object to deletepublic void delete(java.util.Map<java.lang.String,java.lang.Object> example)
VCollection
delete
in interface VCollection
example
- the example objectprotected VCursor createCursor(com.mongodb.DBCursor delegate, Filter<com.mongodb.DBObject> filter)
delegate
- the actual MongoDB cursorfilter
- a filter which decides if a DBObject should be included
into the cursor's result or not (can be null)public VCursor find()
find
in interface VCollection
public VCursor find(java.util.Map<java.lang.String,java.lang.Object> example)
VCollection
find
in interface VCollection
example
- the example objectpublic VCursor find(java.util.Map<java.lang.String,java.lang.Object> example, java.lang.String... fields)
VCollection
find
in interface VCollection
example
- the example objectfields
- the names of the fields to returnpublic java.util.Map<java.lang.String,java.lang.Object> findOne(java.util.Map<java.lang.String,java.lang.Object> example)
VCollection
findOne
in interface VCollection
example
- the example objectpublic java.lang.String getName()
getName
in interface VCollection
protected VCounter getCounter()