Bulk inserts multiple models.
Bulk inserts multiple models.
A scala.collection.TraversableOnce of models.
The number of successful insertions.
Returns the number of documents in this collection matching the given selector.
Returns the number of documents in this collection matching the given selector.
Selector document which may be empty.
Drops this collection
Drops this collection and awaits until it has been dropped or a timeout has occured.
Drops this collection and awaits until it has been dropped or a timeout has occured.
Maximum amount of time to await until this collection has been dropped.
true if the collection has been successfully dropped, otherwise false.
Ensures indexes defined by autoIndexes
.
Retrieves models by page matching the given selector.
Retrieves models by page matching the given selector.
Selector document.
Sorting document.
1 based page number.
Maximum number of elements in each page.
Retrieves all models matching the given selector.
Retrieves all models matching the given selector.
Selector document.
Sorting document.
Removes and returns a single model.
Removes and returns a single model.
The selection criteria for the remove.
Determines which model the operation removes if the query selects multiple models. findAndRemove() removes the first model in the sort order specified by this argument.
Updates and returns a single model.
Updates and returns a single model. It returns the old document by default.
The selection criteria for the update.
Performs an update of the selected model.
Determines which model the operation updates if the query selects multiple models. findAndUpdate() updates the first model in the sort order specified by this argument.
When true, returns the updated model rather than the original.
When true, findAndUpdate() creates a new model if no model matches the query.
Retrieves the model with the given id
.
Retrieves the models with the given ids
.
Retrieves at most one model matching the given selector.
Retrieves a random model matching the given selector.
Retrieves a random model matching the given selector.
This API may require more than one query.
Folds the documents matching the given selector by applying the function f
.
Folds the documents matching the given selector by applying the function f
.
Type of fold result.
Selector document.
Sorting document.
Initial state for the fold operation.
Folding function.
Iterates over the documents matching the given selector and applies the function f
.
Iterates over the documents matching the given selector and applies the function f
.
Selector document.
Sorting document.
function to be applied.
Inserts the given model.
Lists indexes that are currently ensured in this collection.
Lists indexes that are currently ensured in this collection.
This list may not be equal to autoIndexes
in case of index creation failure.
Removes model(s) matching the given selector.
Removes model(s) matching the given selector.
In order to remove multiple documents firstMatchOnly
has to be false
.
Selector document.
Write concern defaults to defaultWriteConcern
.
Remove only the first matching document.
Removes all documents in this collection.
Removes the document with the given ID.
Inserts the document, or updates it if it already exists in the collection.
Inserts the document, or updates it if it already exists in the collection.
The model to save.
the reactivemongo.core.commands.GetLastError command message to send in order to control how the document is inserted. Defaults to defaultWriteConcern.
Updates the documents matching the given selector.
Updates the documents matching the given selector.
Type of the update query.
Selector query.
Update query.
Write concern which defaults to defaultWriteConcern.
Create the document if it does not exist.
Update multiple documents.
Updates the document with the given id
.
Updates the document with the given id
.
Type of the update query.
ID of the document that will be updated.
Update query.
Write concern which defaults to defaultWriteConcern.
The list of indexes to be ensured on DAO load.
The list of indexes to be ensured on DAO load.
Because of Scala initialization order there are exactly 2 ways of defining auto indexes.
First way is to use an early definition:
object PersonDao extends { override val autoIndexes = Seq( Index(Seq("name" -> IndexType.Ascending), unique = true, background = true), Index(Seq("age" -> IndexType.Ascending), background = true)) } with BsonDao[Person, BSONObjectID](MongoContext.db, "persons")
Second way is to override def. Be careful not to change declaration to val
instead of def
.
object PersonDao extends BsonDao[Person, BSONObjectID](MongoContext.db, "persons") { override def autoIndexes = Seq( Index(Seq("name" -> IndexType.Ascending), unique = true, background = true), Index(Seq("age" -> IndexType.Ascending), background = true)) }
Reference to the collection this DAO operates on.
Defines the default write concern for this Dao which defaults to GetLastError()
.
Defines the default write concern for this Dao which defaults to GetLastError()
.
Related API functions should allow overriding this value.
Defines the scala.concurrent.ExecutionContext for this DAO.
Defines the scala.concurrent.ExecutionContext for this DAO.
Defaults to scala.concurrent.ExecutionContext.Implicits.global.
Base class for all DAO implementations. This class defines the API for all DAOs.
A DAO defines how to work with a specific collection.
Type of the collection.
The type that C operates on.
BSONDocument
orJsObject
.Type of the model that this DAO uses.
Type of the ID field of the model.