Inner abstract class to facilitate working with child collections using a typed parent id - no cascading support will be offered, but you can override saves and deletes in the parent DAO to manually cascade children as you like.
Inner abstract class to facilitate working with child collections using a typed parent id - no cascading support will be offered, but you can override saves and deletes in the parent DAO to manually cascade children as you like.
Given parent class Foo
and child class Bar
:
case class Foo(_id: ObjectId, // etc ) case class Bar(_id: ObjectId, parentId: ObjectId, // this refers back to a parent in Foo collection // etc ) object FooDAO extends SalatDAO[Foo, ObjectId](collection = MongoConnection()("db")("fooCollection")) { // and here is a child DAO you can use within FooDAO to work with children of type Bar whose parentId field matches // the supplied parent id of an instance of Foo val bar = new ChildCollection[Bar, ObjectId](collection = MongoConnection()("db")("barCollection"), parentIdField = "parentId") { } }
type of child object
type of child _id field
Supplies the salat.Grater from the implicit salat.Context and ObjectType
manifest
Supplies the salat.Grater from the implicit salat.Context and ObjectType
manifest
salat.Grater to serialize and deserialize ObjectType
If you are mixing and matching abstract and concrete DAOs, turn this on in the concrete DAOs to ensure that querying on a mixed collection will only yield results in the child collection.
If you are mixing and matching abstract and concrete DAOs, turn this on in the concrete DAOs to ensure that querying on a mixed collection will only yield results in the child collection.
MongoDB collection
object for which to search
list of field keys that must exist
list of field keys that must not exist
read preference to use for this search
count of documents matching the search criteria
A central place to modify DBOs before inserting, saving, or updating.
A central place to modify DBOs before inserting, saving, or updating.
object to be serialized
decorated DBO for persisting
A central place to modify find, count and update queries before executing them.
A central place to modify find, count and update queries before executing them.
query to decorate
decorated query for execution
In the absence of a specific read preference, supplies a default read preference.
In the absence of a specific read preference, supplies a default read preference.
default read preference to use for find and findOne
In the absence of a specified write concern, supplies a default write concern.
In the absence of a specified write concern, supplies a default write concern.
default write concern to use for insert, update, save and remove operations
Default description is the case class simple name and the collection.
Default description is the case class simple name and the collection.
DAO description for logging
type view bound to DBObject
type view bound to DBObject
object for which to search
fields to return
sets the desired ReadPreference on the cursor
a typed cursor to iterate over results
Queries for an object in this collection.
Queries for an object in this collection.
type view bound to DBObject
type view bound to DBObject
object for which to search
fields to return
a typed cursor to iterate over results
Queries for an object in this collection.
Queries for an object in this collection.
type view bound to DBObject
object for which to search
a typed cursor to iterate over results
Finds the first document in the query (sorted) and updates it.
Finds the first document in the query (sorted) and updates it.
query to match
sort to apply before picking first document
object with which to modify q
(Option[ObjectType]) Some() of the old document, or None
if no such object exists
Performs a find and update operation.
Performs a find and update operation.
search query to find and modify
object with which to modify q
(Option[ObjectType]) Some() of the object found (before, or after, the update)
type view bound to DBObject
object for which to search
the ReadPreference used for this find
(Option[ObjectType]) Some() of the object found, or None
if no such object exists
Returns a single object from this collection.
Returns a single object from this collection.
type view bound to DBObject
object for which to search
(Option[ObjectType]) Some() of the object found, or None
if no such object exists
identifier
(Option[ObjectType]) Some() of the object found, or None
if no such object exists
Force type hints when objects are persisted.
Force type hints when objects are persisted. Used to support a DAO typed to an abstract superclass or trait. Should be overriden and forced to true when you want to select
type view bound to DBObject
query
list of IDs
collection of ObjectType
instances to insert
write concern
list of object ids TODO: flatten list of IDs - why on earth didn't I do that in the first place?
instance of ObjectType
write concern
if insert succeeds, ID of inserted object
Inserts a group of documents into the database.
Inserts a group of documents into the database.
variable length argument of ObjectType instances
if write concern succeeds, a list of object IDs TODO: this implicit: dumbest design decision on the face of the planet? TODO: replace vararg with traversable TODO: flatten list of IDs - why on earth didn't I do that in the first place?
Inserts a document into the database.
Inserts a document into the database.
instance of ObjectType
if insert succeeds, ID of inserted object
type of projected field
object for which to search
field to project on
implicit manifest typed to P
implicit salat.Context
(Option[P]) Some() of the object found, or None
if no such object exists
type of projected field
object for which to search
field to project on
implicit manifest typed to P
implicit salat.Context
(List[P]) of the objects found
type of projected field
object for which to search
field to project on
implicit manifest typed to P
implicit salat.Context
(Option[P]) Some() of the object found, or None
if no such object exists
type of projected field
object for which to search
field to project on
implicit manifest typed to P
implicit salat.Context
(List[P]) of the objects found
the object that documents to be removed must match
write concern
(WriteResult) result of write operation
object to remove from the collection
write concern
(WriteResult) result of write operation
Removes objects from the database collection.
Removes objects from the database collection.
the object that documents to be removed must match
(WriteResult) result of write operation
Remove a matching object from the collection
Remove a matching object from the collection
object to remove from the collection
(WriteResult) result of write operation
the ID of the document to be removed
write concern
(WriteResult) result of write operation
the list of IDs identifying the list of documents to be removed
wrote concern
(WriteResult) result of write operation
object to save
write concern
(WriteResult) result of write operation
Saves an object to this collection.
Saves an object to this collection.
object to save
(WriteResult) result of write operation
object to transform
object serialized as DBObject
Performs an update operation.
Performs an update operation.
search query for old object to update
object with which to update q
if the database should create the element if it does not exist
if the update should be applied to all objects matching
write concern
(WriteResult) result of write operation
search query for old object to update
object with which to update q
if the database should create the element if it does not exist
if the update should be applied to all objects matching
write concern
(WriteResult) result of write operation
Find an object by its ID.
Find an object by its ID.
identifier
(Option[ObjectType]) Some() of the object found, or None
if no such object exists
(Since version 0.0.8) Use findOneById instead