Use unique indices in MongoDB to ensure that duplicate entries are not created
(CollectionProvider
is a good place to do this).
Use unique indices in MongoDB to ensure that duplicate entries are not created
(CollectionProvider
is a good place to do this).
the parameter, or None
if not added.
Updates the first entry that matches the identity query or creates a new entry if none was found.
Updates the first entry that matches the identity query or creates a new entry if none was found. Involves two hits to the DB.
the parameter or None
if the create failed.
None
if the delete failed, otherwise the parameter.
all results of the query.
all results of the query.
the found entity or None
if the entity was not found in the database.
the found entity or None
if the entity was not found in the database.
if more than one result.
all entities matching the key-based search.
the first entity matching the key-based search, or None
.
the only entity matching the key-based search, or None
.
if more than one result.
all results from the query.
the first result from the result of the query, or None
if nothing found.
the only found entry, or None
if nothing found.
if more than one result.
Find the old entry in the database by comparing it to the first parameter, and update it with the new one.
Find the old entry in the database by comparing it to the first parameter, and update it with the new one. Appropriate when an identity field is changed.
Updates the first entry that matches the identity query.
Updates the first entry that matches the identity query.
the parameter or None
if the entity was not found in the database.
Provides CRUD access to a MongoDB collection using client-provided implicits to:
1. provide the backing MongoDB
DBCollection
. 2. serialise/deserialise the MongoDB representation. 3. provide a concept of identity for UPDATE/DELETE operations. 4. provide a concept of a key for READ operations.MongoDB adds an internal
_id
field to every object that is persisted in the database. It is bad practice to use this_id
field as the MongoDB documentation notes it is possible it may change under highly distributed circumstances.ALl methods throw com.mongodb.MongoException if something bad happened that we didn't expect (e.g. I/O or config).
Thinking notes on the API design