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. abstract def _grater: Grater[ObjectType]

    returns

    Grater to serialize and deserialize ObjectType

  2. abstract def collection: MongoCollection

    returns

    MongoDB collection

  3. abstract def count(q: DBObject = MongoDBObject.empty, fieldsThatMustExist: List[String] = Nil, fieldsThatMustNotExist: List[String] = Nil, rp: ReadPreference = defaultReadPreference): 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

    rp

    read preference to use for this search

    returns

    count of documents matching the search criteria

    Definition Classes
    BaseDAOMethods
  4. abstract def find[A, B](ref: A, keys: B, rp: ReadPreference)(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

    rp

    read preference to use for this search

    returns

    a typed cursor to iterate over results

    Definition Classes
    BaseDAOMethods
  5. abstract def findOne[A](t: A, rp: ReadPreference)(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

    rp

    the read preference for this search

    returns

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

    Definition Classes
    BaseDAOMethods
  6. abstract 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
  7. abstract 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

    Definition Classes
    BaseDAOMethods
  8. abstract 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?

    Definition Classes
    BaseDAOMethods
  9. abstract 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

    Definition Classes
    BaseDAOMethods
  10. abstract 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

    Definition Classes
    BaseDAOMethods
  11. abstract 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

    Definition Classes
    BaseDAOMethods
  12. abstract 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

    Definition Classes
    BaseDAOMethods
  13. abstract 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

    Definition Classes
    BaseDAOMethods
  14. abstract 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

    Definition Classes
    BaseDAOMethods
  15. abstract 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

    Definition Classes
    BaseDAOMethods
  16. abstract 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

    Definition Classes
    BaseDAOMethods
  17. abstract 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

    Definition Classes
    BaseDAOMethods
  18. abstract 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

    Definition Classes
    BaseDAOMethods
  19. abstract 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

    Definition Classes
    BaseDAOMethods

Concrete Value Members

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

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

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

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

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

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

    Definition Classes
    Any
  7. def clone(): AnyRef

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

    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.

    returns

    default read preference to use for find and findOne

    Definition Classes
    DAOBaseDAOMethods
  9. 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
  10. def description: String

    returns

    DAO description for logging

  11. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  12. def equals(arg0: Any): Boolean

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

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  14. 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

    Definition Classes
    BaseDAOMethods
  15. 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
  16. 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

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

    Definition Classes
    AnyRef → Any
  18. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  19. 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
  20. 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
  21. final def isInstanceOf[T0]: Boolean

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

    Definition Classes
    AnyRef
  23. final def notify(): Unit

    Definition Classes
    AnyRef
  24. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  25. 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
  26. 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
  27. 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
  28. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  29. def toDBObject(o: ObjectType): DBObject

    o

    object to transform

    returns

    object serialized as DBObject

    Definition Classes
    DAOBaseDAOMethods
  30. def toString(): String

    Definition Classes
    AnyRef → Any
  31. 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
  32. final def wait(): Unit

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

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

    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

    (Since version 0.0.8) Use findOneById instead

Inherited from BaseDAOMethods[ObjectType, ID]

Inherited from AnyRef

Inherited from Any