com.novus.salat.dao.SalatDAO

ChildCollection

abstract class ChildCollection[ChildType <: AnyRef, ChildID] extends SalatDAO[ChildType, ChildID]

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") { }

 }
ChildType

type of child object

ChildID

type of child _id field

Self Type
ChildCollection[ChildType, ChildID]
Linear Supertypes
SalatDAO[ChildType, ChildID], Logging, DAO[ChildType, ChildID], BaseDAOMethods[ChildType, ChildID], AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Hide All
  2. Show all
  1. ChildCollection
  2. SalatDAO
  3. Logging
  4. DAO
  5. BaseDAOMethods
  6. AnyRef
  7. Any
Visibility
  1. Public
  2. All

Instance Constructors

  1. new ChildCollection(collection: MongoCollection, parentIdField: String)(implicit mct: Manifest[ChildType], mcid: Manifest[ChildID], ctx: Context)

    collection

    MongoDB collection

    parentIdField

    parent id field key

    mct

    implicit manifest for ChildType

    mcid

    implicit manifest for ChildID

    ctx

    implicit Context

Type Members

  1. abstract class ChildCollection[ChildType <: AnyRef, ChildID] extends SalatDAO[ChildType, ChildID]

    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.

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. val _grater: Grater[ChildType]

    Supplies the Grater from the implicit Context and ObjectType manifest

    Supplies the Grater from the implicit Context and ObjectType manifest

    returns

    Grater to serialize and deserialize ObjectType

    Definition Classes
    SalatDAODAO
  7. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  8. def clone(): AnyRef

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  9. val collection: MongoCollection

    MongoDB collection

    MongoDB collection

    Definition Classes
    ChildCollectionSalatDAODAO
  10. def count(q: DBObject = MongoDBObject.empty, fieldsThatMustExist: List[String] = Nil, fieldsThatMustNotExist: List[String] = Nil): Long

    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

    Definition Classes
    SalatDAOBaseDAOMethods
  11. def countByParentId(parentId: ID, query: DBObject = MongoDBObject.empty, fieldsThatMustExist: List[String] = Nil, fieldsThatMustNotExist: List[String] = Nil): Long

    Count the number of documents matching the parent id.

    Count the number of documents matching the parent id.

    parentId

    parent id

    query

    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

  12. 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
  13. lazy val description: String

    Definition Classes
    ChildCollectionSalatDAODAO
  14. final def eq(arg0: AnyRef): Boolean

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

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

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  17. def find[A, B](ref: A, keys: B)(implicit arg0: (A) ⇒ DBObject, arg1: (B) ⇒ DBObject): SalatMongoCursor[ChildType]

    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
    SalatDAOBaseDAOMethods
  18. def find[A](ref: A)(implicit arg0: (A) ⇒ DBObject): SalatMongoCursor[ChildType]

    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
  19. def findByParentId(parentId: ID, query: DBObject, keys: DBObject): SalatMongoCursor[ChildType]

    parentId

    parent id

    query

    object for which to search

    returns

    list of child objects matching parent id and search criteria

  20. def findByParentId(parentId: ID, query: DBObject = MongoDBObject.empty): SalatMongoCursor[ChildType]

    parentId

    parent id

    query

    object for which to search

    returns

    list of child objects matching parent id and search criteria

  21. def findByParentIds(parentIds: List[ID], query: DBObject, keys: DBObject): SalatMongoCursor[ChildType]

    parentIds

    parent ids

    query

    object for which to search

    returns

    list of child objects matching parent ids and search criteria

  22. def findByParentIds(parentIds: List[ID], query: DBObject = MongoDBObject.empty): SalatMongoCursor[ChildType]

    parentIds

    list of parent ids

    query

    object for which to search

    returns

    list of child objects matching parent ids and search criteria

  23. def findOne[A](t: A)(implicit arg0: (A) ⇒ DBObject): Option[ChildType]

    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
    SalatDAOBaseDAOMethods
  24. def findOneById(id: ChildID): Option[ChildType]

    id

    identifier

    returns

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

    Definition Classes
    SalatDAOBaseDAOMethods
  25. final def getClass(): java.lang.Class[_]

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

    Definition Classes
    AnyRef → Any
  27. def ids[A](query: A)(implicit arg0: (A) ⇒ DBObject): List[ChildID]

    A

    type view bound to DBObject

    query

    query

    returns

    list of IDs

    Definition Classes
    SalatDAOBaseDAOMethods
  28. def idsForParentId(parentId: ID, query: DBObject = MongoDBObject.empty): List[ChildID]

    parentId

    parent id

    query

    object for which to search

    returns

    list of child ids matching parent id and search criteria

  29. def idsForParentIds(parentIds: List[ID], query: DBObject = MongoDBObject.empty): List[ChildID]

    parentIds

    list of parent ids

    query

    object for which to search

    returns

    list of child ids matching parent ids and search criteria

  30. def insert(docs: Traversable[ChildType], wc: WriteConcern = defaultWriteConcern): List[Option[ChildID]]

    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
    SalatDAOBaseDAOMethods
  31. def insert(t: ChildType, wc: WriteConcern): Option[ChildID]

    t

    instance of ObjectType

    wc

    write concern

    returns

    if insert succeeds, ID of inserted object

    Definition Classes
    SalatDAOBaseDAOMethods
  32. def insert(docs: ChildType*)(implicit wc: WriteConcern): List[Option[ChildID]]

    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
  33. def insert(t: ChildType): Option[ChildID]

    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
  34. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  35. var log: Logger

    Attributes
    protected[casbah]
    Definition Classes
    Logging
  36. final def ne(arg0: AnyRef): Boolean

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

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

    Definition Classes
    AnyRef
  39. val parentIdField: String

    parent id field key

  40. def parentIdQuery(parentId: ID): DBObject

    parentId

    parent id

    returns

    base query object for a single parent id

  41. def parentIdsQuery(parentIds: List[ID]): DBObject

    parentIds

    list of parent ids

    returns

    base query object for a list of parent ids TODO - replace list with traversable

  42. def primitiveProjection[P](query: DBObject, field: String)(implicit m: Manifest[P], ctx: Context): Option[P]

    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
    SalatDAOBaseDAOMethods
  43. def primitiveProjections[P](query: DBObject, field: String)(implicit m: Manifest[P], ctx: Context): List[P]

    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
    SalatDAOBaseDAOMethods
  44. def primitiveProjectionsByParentId[R](parentId: ID, field: String, query: DBObject = MongoDBObject.empty)(implicit mr: Manifest[R], ctx: Context): List[R]

    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

    R

    type of projected field

    parentId

    parent id

    field

    field to project on

    query

    (optional) object for which to search

    mr

    implicit manifest typed to R

    ctx

    implicit Context

    returns

    (List[R]) of the objects found

  45. def primitiveProjectionsByParentIds[R](parentIds: List[ID], field: String, query: DBObject = MongoDBObject.empty)(implicit mr: Manifest[R], ctx: Context): List[R]

    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

    R

    type of projected field

    parentIds

    parent ids

    field

    field to project on

    query

    (optional) object for which to search

    mr

    implicit manifest typed to R

    ctx

    implicit Context

    returns

    (List[R]) of the objects found

  46. def projection[P <: CaseClass](query: DBObject, field: String)(implicit m: Manifest[P], ctx: Context): Option[P]

    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
    SalatDAOBaseDAOMethods
  47. def projections[P <: CaseClass](query: DBObject, field: String)(implicit m: Manifest[P], ctx: Context): List[P]

    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
    SalatDAOBaseDAOMethods
  48. def projectionsByParentId[R <: CaseClass](parentId: ID, field: String, query: DBObject = MongoDBObject.empty)(implicit mr: Manifest[R], ctx: Context): List[R]

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

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

    R

    type of projected field

    parentId

    parent id

    field

    field to project on

    query

    (optional) object for which to search

    mr

    implicit manifest typed to R

    ctx

    implicit Context

    returns

    (List[R]) of the objects found

  49. def projectionsByParentIds[R <: CaseClass](parentIds: List[ID], field: String, query: DBObject = MongoDBObject.empty)(implicit mr: Manifest[R], ctx: Context): List[R]

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

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

    R

    type of projected field

    parentIds

    parent ids

    field

    field to project on

    query

    (optional) object for which to search

    mr

    implicit manifest typed to R

    ctx

    implicit Context

    returns

    (List[R]) of the objects found

  50. def remove[A](q: A, wc: WriteConcern)(implicit arg0: (A) ⇒ DBObject): Unit

    q

    the object that documents to be removed must match

    wc

    write concern

    Definition Classes
    SalatDAOBaseDAOMethods
  51. def remove(t: ChildType, wc: WriteConcern): Unit

    t

    object to remove from the collection

    wc

    write concern

    Definition Classes
    SalatDAOBaseDAOMethods
  52. def remove[A](q: A)(implicit arg0: (A) ⇒ DBObject): Unit

    Removes objects from the database collection.

    Removes objects from the database collection.

    q

    the object that documents to be removed must match

    Definition Classes
    BaseDAOMethods
  53. def remove(t: ChildType): Unit

    Remove a matching object from the collection

    Remove a matching object from the collection

    t

    object to remove from the collection

    Definition Classes
    BaseDAOMethods
  54. def removeById(id: ChildID, wc: WriteConcern = defaultWriteConcern): Unit

    id

    the ID of the document to be removed

    wc

    write concern

    Definition Classes
    SalatDAOBaseDAOMethods
  55. def removeByIds(ids: List[ChildID], wc: WriteConcern): Unit

    ids

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

    wc

    wrote concern

    Definition Classes
    SalatDAOBaseDAOMethods
  56. def removeByParentId(parentId: ID, wc: WriteConcern = collection.writeConcern): Unit

    Remove documents matching parent id

    Remove documents matching parent id

    parentId

    parent id

    wc

    write concern

  57. def removeByParentIds(parentIds: List[ID], wc: WriteConcern = collection.writeConcern): Unit

    Remove documents matching parent ids

    Remove documents matching parent ids

    parentIds

    parent ids

    wc

    write concern

  58. def save(t: ChildType, wc: WriteConcern): Unit

    t

    object to save

    wc

    write concern

    Definition Classes
    SalatDAOBaseDAOMethods
  59. def save(t: ChildType): Unit

    Saves an object to this collection.

    Saves an object to this collection.

    t

    object to save

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

    Definition Classes
    AnyRef
  61. def toDBObject(o: ChildType): DBObject

    o

    object to transform

    returns

    object serialized as DBObject

    Definition Classes
    DAOBaseDAOMethods
  62. def toString(): String

    Definition Classes
    AnyRef → Any
  63. def update(q: DBObject, o: DBObject, upsert: Boolean = false, multi: Boolean = false, wc: WriteConcern = defaultWriteConcern): Unit

    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

    Definition Classes
    SalatDAOBaseDAOMethods
  64. def update(q: DBObject, t: ChildType, upsert: Boolean, multi: Boolean, wc: WriteConcern): Unit

    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

    Definition Classes
    BaseDAOMethods
  65. def updateByParentId[A](parentId: ID, o: A, upsert: Boolean, multi: Boolean, wc: WriteConcern)(implicit arg0: (A) ⇒ DBObject): Unit

    A

    type view bound to DBObject

    parentId

    parent id

    o

    object with which to update the document(s) matching parentId

    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

  66. def updateByParentIds[A](parentIds: List[ID], o: A, upsert: Boolean, multi: Boolean, wc: WriteConcern)(implicit arg0: (A) ⇒ DBObject): Unit

    A

    type view bound to DBObject

    parentIds

    parent ids

    o

    object with which to update the document(s) matching parentIds

    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

  67. final def wait(): Unit

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

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

    Definition Classes
    AnyRef
    Annotations
    @throws()

Deprecated Value Members

  1. def findOneByID(id: ChildID): Option[ChildType]

    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 SalatDAO[ChildType, ChildID]

Inherited from Logging

Inherited from DAO[ChildType, ChildID]

Inherited from BaseDAOMethods[ChildType, ChildID]

Inherited from AnyRef

Inherited from Any