com.novus.salat.dao

DAO

trait DAO [ObjectType <: AnyRef, ID] extends BaseDAOMethods[ObjectType, ID]

Base DAO class.

Where WriteConcern is not specified as a parameter on an operation which modifies or removes documents from the collection, then the default write concern of the collection is assumed.

ObjectType

class to be persisted

ID

_id type

Linear Supertypes
BaseDAOMethods[ObjectType, ID], AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Hide All
  2. Show all
  1. DAO
  2. BaseDAOMethods
  3. AnyRef
  4. Any
Visibility
  1. Public
  2. All

Abstract Value Members

  1. def _grater : Grater[ObjectType]

    returns

    Grater to serialize and deserialize ObjectType

    Attributes
    abstract
  2. def collection : MongoCollection

    returns

    MongoDB collection

    Attributes
    abstract
  3. def count (q: DBObject = MongoDBObject.empty, fieldsThatMustExist: List[String] = Nil, fieldsThatMustNotExist: List[String] = Nil): Long

    Count the number of documents matching the search criteria.

    Count the number of documents matching the search criteria.

    q

    object for which to search

    fieldsThatMustExist

    list of field keys that must exist

    fieldsThatMustNotExist

    list of field keys that must not exist

    returns

    count of documents matching the search criteria

    Attributes
    abstract
    Definition Classes
    BaseDAOMethods
  4. def find [A, B] (ref: A, keys: B)(implicit arg0: (A) ⇒ DBObject, arg1: (B) ⇒ DBObject): SalatMongoCursor[ObjectType]

    Queries for an object in this collection.

    Queries for an object in this collection.

    A

    type view bound to DBObject

    B

    type view bound to DBObject

    ref

    object for which to search

    keys

    fields to return

    returns

    a typed cursor to iterate over results

    Attributes
    abstract
    Definition Classes
    BaseDAOMethods
  5. def findOne [A] (t: A)(implicit arg0: (A) ⇒ DBObject): Option[ObjectType]

    Returns a single object from this collection.

    Returns a single object from this collection.

    A

    type view bound to DBObject

    t

    object for which to search

    returns

    (Option[ObjectType]) Some() of the object found, or None if no such object exists

    Attributes
    abstract
    Definition Classes
    BaseDAOMethods
  6. def findOneById (id: ID): Option[ObjectType]

    Find an object by its ID.

    Find an object by its ID.

    id

    identifier

    returns

    (Option[ObjectType]) Some() of the object found, or None if no such object exists

    Attributes
    abstract
    Definition Classes
    BaseDAOMethods
  7. def ids [A] (query: A)(implicit arg0: (A) ⇒ DBObject): List[ID]

    Queries for a list of identifiers.

    Queries for a list of identifiers.

    A

    type view bound to DBObject

    query

    query

    returns

    list of IDs

    Attributes
    abstract
    Definition Classes
    BaseDAOMethods
  8. def insert (docs: Traversable[ObjectType], wc: WriteConcern): List[Option[ID]]

    docs

    collection of ObjectType instances to insert

    wc

    write concern

    returns

    list of object ids TODO: flatten list of IDs - why on earth didn't I do that in the first place?

    Attributes
    abstract
    Definition Classes
    BaseDAOMethods
  9. def insert (t: ObjectType, wc: WriteConcern): Option[ID]

    Inserts a document into the database.

    Inserts a document into the database.

    t

    instance of ObjectType

    wc

    write concern

    returns

    if insert succeeds, ID of inserted object

    Attributes
    abstract
    Definition Classes
    BaseDAOMethods
  10. def primitiveProjection [P] (query: DBObject, field: String)(implicit m: Manifest[P], ctx: Context): Option[P]

    Projection typed to a type for which Casbah or mongo-java-driver handles conversion

    Projection typed to a type for which Casbah or mongo-java-driver handles conversion

    P

    type of projected field

    query

    object for which to search

    field

    field to project on

    m

    implicit manifest typed to P

    ctx

    implicit Context

    returns

    (Option[P]) Some() of the object found, or None if no such object exists

    Attributes
    abstract
    Definition Classes
    BaseDAOMethods
  11. def primitiveProjections [P] (query: DBObject, field: String)(implicit m: Manifest[P], ctx: Context): List[P]

    Projection typed to a type for which Casbah or mongo-java-driver handles conversion

    Projection typed to a type for which Casbah or mongo-java-driver handles conversion

    P

    type of projected field

    query

    object for which to search

    field

    field to project on

    m

    implicit manifest typed to P

    ctx

    implicit Context

    returns

    (List[P]) of the objects found

    Attributes
    abstract
    Definition Classes
    BaseDAOMethods
  12. def projection [P <: CaseClass] (query: DBObject, field: String)(implicit m: Manifest[P], ctx: Context): Option[P]

    Projection typed to a case class, trait or abstract superclass.

    Projection typed to a case class, trait or abstract superclass.

    P

    type of projected field

    query

    object for which to search

    field

    field to project on

    m

    implicit manifest typed to P

    ctx

    implicit Context

    returns

    (Option[P]) Some() of the object found, or None if no such object exists

    Attributes
    abstract
    Definition Classes
    BaseDAOMethods
  13. def projections [P <: CaseClass] (query: DBObject, field: String)(implicit m: Manifest[P], ctx: Context): List[P]

    Projection typed to a case class, trait or abstract superclass.

    Projection typed to a case class, trait or abstract superclass.

    P

    type of projected field

    query

    object for which to search

    field

    field to project on

    m

    implicit manifest typed to P

    ctx

    implicit Context

    returns

    (List[P]) of the objects found

    Attributes
    abstract
    Definition Classes
    BaseDAOMethods
  14. def remove [A] (q: A, wc: WriteConcern)(implicit arg0: (A) ⇒ DBObject): WriteResult

    Removes objects from the database collection.

    Removes objects from the database collection.

    q

    the object that documents to be removed must match

    wc

    write concern

    returns

    (WriteResult) result of write operation

    Attributes
    abstract
    Definition Classes
    BaseDAOMethods
  15. def remove (t: ObjectType, wc: WriteConcern): WriteResult

    Remove a matching object from the collection

    Remove a matching object from the collection

    t

    object to remove from the collection

    wc

    write concern

    returns

    (WriteResult) result of write operation

    Attributes
    abstract
    Definition Classes
    BaseDAOMethods
  16. def removeById (id: ID, wc: WriteConcern = defaultWriteConcern): WriteResult

    Remove document identified by this ID.

    Remove document identified by this ID.

    id

    the ID of the document to be removed

    wc

    write concern

    returns

    (WriteResult) result of write operation

    Attributes
    abstract
    Definition Classes
    BaseDAOMethods
  17. def removeByIds (ids: List[ID], wc: WriteConcern = defaultWriteConcern): WriteResult

    Remove documents matching any of the supplied list of IDs.

    Remove documents matching any of the supplied list of IDs.

    ids

    the list of IDs identifying the list of documents to be removed

    wc

    wrote concern

    returns

    (WriteResult) result of write operation

    Attributes
    abstract
    Definition Classes
    BaseDAOMethods
  18. def save (t: ObjectType, wc: WriteConcern): WriteResult

    Saves an object to this collection.

    Saves an object to this collection.

    t

    object to save

    wc

    write concern

    returns

    (WriteResult) result of write operation

    Attributes
    abstract
    Definition Classes
    BaseDAOMethods
  19. def update (q: DBObject, o: DBObject, upsert: Boolean, multi: Boolean, wc: WriteConcern): WriteResult

    Performs an update operation.

    Performs an update operation.

    q

    search query for old object to update

    o

    object with which to update q

    upsert

    if the database should create the element if it does not exist

    multi

    if the update should be applied to all objects matching

    wc

    write concern

    returns

    (WriteResult) result of write operation

    Attributes
    abstract
    Definition Classes
    BaseDAOMethods

Concrete Value Members

  1. def != (arg0: AnyRef): Boolean

    Attributes
    final
    Definition Classes
    AnyRef
  2. def != (arg0: Any): Boolean

    Attributes
    final
    Definition Classes
    Any
  3. def ## (): Int

    Attributes
    final
    Definition Classes
    AnyRef → Any
  4. def == (arg0: AnyRef): Boolean

    Attributes
    final
    Definition Classes
    AnyRef
  5. def == (arg0: Any): Boolean

    Attributes
    final
    Definition Classes
    Any
  6. def asInstanceOf [T0] : T0

    Attributes
    final
    Definition Classes
    Any
  7. def clone (): AnyRef

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  8. def defaultWriteConcern : WriteConcern

    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.

    returns

    default write concern to use for insert, update, save and remove operations

    Definition Classes
    DAOBaseDAOMethods
  9. def description : String

    returns

    DAO description for logging

  10. def eq (arg0: AnyRef): Boolean

    Attributes
    final
    Definition Classes
    AnyRef
  11. def equals (arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  12. def finalize (): Unit

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  13. def find [A] (ref: A)(implicit arg0: (A) ⇒ DBObject): SalatMongoCursor[ObjectType]

    Queries for an object in this collection.

    Queries for an object in this collection.

    A

    type view bound to DBObject

    ref

    object for which to search

    returns

    a typed cursor to iterate over results

    Definition Classes
    BaseDAOMethods
  14. def getClass (): java.lang.Class[_]

    Attributes
    final
    Definition Classes
    AnyRef → Any
  15. def hashCode (): Int

    Definition Classes
    AnyRef → Any
  16. def insert (docs: ObjectType*)(implicit wc: WriteConcern): List[Option[ID]]

    Inserts a group of documents into the database.

    Inserts a group of documents into the database.

    docs

    variable length argument of ObjectType instances

    returns

    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?

    Definition Classes
    BaseDAOMethods
  17. def insert (t: ObjectType): Option[ID]

    Inserts a document into the database.

    Inserts a document into the database.

    t

    instance of ObjectType

    returns

    if insert succeeds, ID of inserted object

    Definition Classes
    BaseDAOMethods
  18. def isInstanceOf [T0] : Boolean

    Attributes
    final
    Definition Classes
    Any
  19. def ne (arg0: AnyRef): Boolean

    Attributes
    final
    Definition Classes
    AnyRef
  20. def notify (): Unit

    Attributes
    final
    Definition Classes
    AnyRef
  21. def notifyAll (): Unit

    Attributes
    final
    Definition Classes
    AnyRef
  22. def remove [A] (q: A)(implicit arg0: (A) ⇒ DBObject): WriteResult

    Removes objects from the database collection.

    Removes objects from the database collection.

    q

    the object that documents to be removed must match

    returns

    (WriteResult) result of write operation

    Definition Classes
    BaseDAOMethods
  23. def remove (t: ObjectType): WriteResult

    Remove a matching object from the collection

    Remove a matching object from the collection

    t

    object to remove from the collection

    returns

    (WriteResult) result of write operation

    Definition Classes
    BaseDAOMethods
  24. def save (t: ObjectType): WriteResult

    Saves an object to this collection.

    Saves an object to this collection.

    t

    object to save

    returns

    (WriteResult) result of write operation

    Definition Classes
    BaseDAOMethods
  25. def synchronized [T0] (arg0: ⇒ T0): T0

    Attributes
    final
    Definition Classes
    AnyRef
  26. def toDBObject (o: ObjectType): DBObject

    o

    object to transform

    returns

    object serialized as DBObject

    Definition Classes
    DAOBaseDAOMethods
  27. def toString (): String

    Definition Classes
    AnyRef → Any
  28. def update (q: DBObject, t: ObjectType, upsert: Boolean, multi: Boolean, wc: WriteConcern): WriteResult

    Performs an update operation.

    Performs an update operation.

    q

    search query for old object to update

    t

    object with which to update q

    upsert

    if the database should create the element if it does not exist

    multi

    if the update should be applied to all objects matching

    wc

    write concern

    returns

    (WriteResult) result of write operation

    Definition Classes
    BaseDAOMethods
  29. def wait (): Unit

    Attributes
    final
    Definition Classes
    AnyRef
    Annotations
    @throws()
  30. def wait (arg0: Long, arg1: Int): Unit

    Attributes
    final
    Definition Classes
    AnyRef
    Annotations
    @throws()
  31. def wait (arg0: Long): Unit

    Attributes
    final
    Definition Classes
    AnyRef
    Annotations
    @throws()

Deprecated Value Members

  1. def findOneByID (id: ID): Option[ObjectType]

    Find an object by its ID.

    Find an object by its ID.

    id

    identifier

    returns

    (Option[ObjectType]) Some() of the object found, or None if no such object exists

    Definition Classes
    BaseDAOMethods
    Annotations
    @deprecated
    Deprecated

    Use findOneById instead

Inherited from BaseDAOMethods[ObjectType, ID]

Inherited from AnyRef

Inherited from Any