public class MongoDBConverter extends Object
The MongoDB native "_id" can optionally be translated into a custom id in memory (usually "ecm:id"). Otherwise it is stripped from returned results.
Modifier and Type | Class and Description |
---|---|
class |
MongoDBConverter.UpdateBuilder
Update list builder to prevent several updates of the same field.
|
Modifier and Type | Field and Description |
---|---|
protected String |
idKey
The key to use in memory to map the database native "_id".
|
Constructor and Description |
---|
MongoDBConverter()
Constructor for a converter that does not map the MongoDB native "_id".
|
MongoDBConverter(String idKey)
Constructor for a converter that also knows to optionally translate the native MongoDB "_id" into a custom id.
|
Modifier and Type | Method and Description |
---|---|
String |
bsonToKey(String key) |
State |
bsonToState(org.bson.Document doc) |
Serializable |
bsonToValue(Object value) |
List<org.bson.Document> |
diffToBson(State.StateDiff diff)
Constructs a list of MongoDB updates from the given
State.StateDiff . |
String |
keyToBson(String key) |
List<Object> |
listToBson(List<Object> values) |
Serializable |
scalarToSerializable(Object val) |
Class<?> |
scalarToSerializableClass(Class<?> klass) |
Object |
serializableToBson(Object value) |
org.bson.Document |
stateToBson(State state) |
Object |
valueToBson(Object value) |
public MongoDBConverter()
public MongoDBConverter(String idKey)
idKey
- the key to use to map the native "_id" in memory, if not null
public List<org.bson.Document> diffToBson(State.StateDiff diff)
State.StateDiff
.
We need a list because some cases need two operations to avoid conflicts.
public Object valueToBson(Object value)
public org.bson.Document stateToBson(State state)
public List<Object> listToBson(List<Object> values)
public State bsonToState(org.bson.Document doc)
public Serializable bsonToValue(Object value)
public Object serializableToBson(Object value)
public Serializable scalarToSerializable(Object val)
public Class<?> scalarToSerializableClass(Class<?> klass)
Copyright © 2019 Nuxeo. All rights reserved.