Class MongoDBConverter

java.lang.Object
org.nuxeo.ecm.core.storage.mongodb.MongoDBConverter

public class MongoDBConverter extends Object
Converts between MongoDB types (bson) and DBS types (diff, state, list, serializable).

The MongoDB native "_id" can optionally be translated into a custom id in memory (usually "ecm:id"). Otherwise it is stripped from returned results.

Since:
9.1
  • Field Details

    • idKey

      protected final String idKey
      The key to use in memory to map the database native "_id".
    • trueOrNullBooleanKeys

      protected final Set<String> trueOrNullBooleanKeys
      The keys for booleans whose value is true or null (instead of false).
    • idValuesKeys

      protected final Set<String> idValuesKeys
      The keys whose values are ids and are stored as longs.
    • HEX_RE

      protected static final Pattern HEX_RE
  • Constructor Details

    • MongoDBConverter

      public MongoDBConverter()
      Constructor for a converter that does not map the MongoDB native "_id".
      Since:
      10.3
    • MongoDBConverter

      public MongoDBConverter(String idKey, Set<String> trueOrNullBooleanKeys, Set<String> idValuesKeys)
      Constructor for a converter that also knows to optionally translate the native MongoDB "_id" into a custom id.

      When idValuesKeys are provided, the ids are stored as longs.

      Parameters:
      idKey - the key to use to map the native "_id" in memory, if not null
      trueOrNullBooleanKeys - the keys corresponding to boolean values that are only true or null (instead of false)
      idValuesKeys - the keys corresponding to values that are ids
  • Method Details