org.eigengo.scalad.mongo

MongoCrud

class MongoCrud extends MongoCreate with MongoSearch with MongoUpdate with MongoDelete with MongoRead with MongoFind with MongoCreateOrUpdate with MongoModify with MongoAggregate with MongoCount

Provides CRUD access to a MongoDB collection using client-provided implicits to:

1. provide the backing MongoDB DBCollection. 2. serialise/deserialise the MongoDB representation. 3. provide a concept of identity for UPDATE/DELETE operations. 4. provide a concept of a key for READ operations.

MongoDB adds an internal _id field to every object that is persisted in the database. It is bad practice to use this _id field as the MongoDB documentation notes it is possible it may change under highly distributed circumstances.

ALl methods throw com.mongodb.MongoException if something bad happened that we didn't expect (e.g. I/O or config).

See also

Thinking notes on the API design

Linear Supertypes
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. MongoCrud
  2. MongoCount
  3. MongoAggregate
  4. MongoModify
  5. MongoCreateOrUpdate
  6. MongoFind
  7. MongoRead
  8. MongoDelete
  9. MongoUpdate
  10. MongoSearch
  11. JavaLogging
  12. MongoCreate
  13. AnyRef
  14. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Instance Constructors

  1. new MongoCrud()

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. def aggregate[T](pipeline: DBObject*)(implicit arg0: CollectionProvider[T]): List[DBObject]

    Definition Classes
    MongoAggregate
  7. def aggregateCount[T](pipeline: DBObject*)(implicit arg0: CollectionProvider[T]): Long

    Definition Classes
    MongoAggregate
  8. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  9. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  10. def count[T](query: DBObject)(implicit provider: CollectionProvider[T]): Long

    Definition Classes
    MongoCount
  11. def create[T](entity: T, concern: WriteConcern = null)(implicit arg0: CollectionProvider[T], arg1: MongoSerialiser[T]): Option[T]

    Use unique indices in MongoDB to ensure that duplicate entries are not created (CollectionProvider is a good place to do this).

    Use unique indices in MongoDB to ensure that duplicate entries are not created (CollectionProvider is a good place to do this).

    returns

    the parameter, or None if not added.

    Definition Classes
    MongoCreate
  12. def createOrUpdateFirst[T](entity: T)(implicit arg0: CollectionProvider[T], arg1: MongoSerialiser[T], arg2: IdentityQueryBuilder[T]): Option[T]

    Updates the first entry that matches the identity query or creates a new entry if none was found.

    Updates the first entry that matches the identity query or creates a new entry if none was found. Involves two hits to the DB.

    returns

    the parameter or None if the create failed.

    Definition Classes
    MongoCreateOrUpdate
  13. def deleteFirst[T](entity: T)(implicit arg0: CollectionProvider[T], arg1: IdentityQueryBuilder[T]): Option[T]

    returns

    None if the delete failed, otherwise the parameter.

    Definition Classes
    MongoDelete
  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[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  17. def findAll[T](implicit arg0: CollectionProvider[T], arg1: MongoSerialiser[T]): ConsumerIterator[T]

    returns

    all results of the query.

    Definition Classes
    MongoFind
  18. def findAll[T](entity: T)(implicit arg0: CollectionProvider[T], arg1: MongoSerialiser[T], arg2: IdentityQueryBuilder[T]): ConsumerIterator[T]

    returns

    all results of the query.

    Definition Classes
    MongoFind
  19. def findAndModify[T](query: DBObject, rule: DBObject)(implicit provider: CollectionProvider[T]): Unit

    Definition Classes
    MongoModify
  20. def findFirst[T](entity: T)(implicit arg0: CollectionProvider[T], arg1: MongoSerialiser[T], arg2: IdentityQueryBuilder[T]): Option[T]

    returns

    the found entity or None if the entity was not found in the database.

    Definition Classes
    MongoFind
  21. def findUnique[T](entity: T)(implicit arg0: CollectionProvider[T], arg1: MongoSerialiser[T], arg2: IdentityQueryBuilder[T]): Option[T]

    returns

    the found entity or None if the entity was not found in the database.

    Definition Classes
    MongoFind
    Exceptions thrown
    TooManyResults

    if more than one result.

  22. final def getClass(): Class[_]

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

    Definition Classes
    AnyRef → Any
  24. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  25. lazy val log: JavaLoggingAdapter

    Attributes
    protected
    Definition Classes
    JavaLogging
  26. def modify[T, K](id: K, rule: DBObject)(implicit provider: CollectionProvider[T], builder: KeyQueryBuilder[T, K]): Unit

    Definition Classes
    MongoModify
  27. final def ne(arg0: AnyRef): Boolean

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

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

    Definition Classes
    AnyRef
  30. def readAll[T, K](key: K)(implicit keyBuilder: KeyQueryBuilder[T, K], collectionProvider: CollectionProvider[T], serialiser: MongoSerialiser[T]): ConsumerIterator[T]

    returns

    all entities matching the key-based search.

    Definition Classes
    MongoRead
  31. def readFirst[T, K](key: K)(implicit keyBuilder: KeyQueryBuilder[T, K], collectionProvider: CollectionProvider[T], serialiser: MongoSerialiser[T]): Option[T]

    returns

    the first entity matching the key-based search, or None.

    Definition Classes
    MongoRead
  32. def readUnique[T, K](key: K)(implicit keyBuilder: KeyQueryBuilder[T, K], collectionProvider: CollectionProvider[T], serialiser: MongoSerialiser[T]): Option[T]

    returns

    the only entity matching the key-based search, or None.

    Definition Classes
    MongoRead
    Exceptions thrown
    TooManyResults

    if more than one result.

  33. def searchAll[T](query: DBObject)(implicit arg0: CollectionProvider[T], arg1: MongoSerialiser[T]): ConsumerIterator[T]

    returns

    all results from the query.

    Definition Classes
    MongoSearch
  34. def searchFirst[T](query: DBObject)(implicit arg0: CollectionProvider[T], arg1: MongoSerialiser[T]): Option[T]

    returns

    the first result from the result of the query, or None if nothing found.

    Definition Classes
    MongoSearch
  35. def searchUnique[T](query: DBObject)(implicit arg0: CollectionProvider[T], arg1: MongoSerialiser[T]): Option[T]

    returns

    the only found entry, or None if nothing found.

    Definition Classes
    MongoSearch
    Exceptions thrown
    TooManyResults

    if more than one result.

  36. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  37. def toString(): String

    Definition Classes
    AnyRef → Any
  38. def updateFirst[T](old: T, update: T)(implicit arg0: IdentityQueryBuilder[T], arg1: MongoSerialiser[T], arg2: CollectionProvider[T]): Option[T]

    Find the old entry in the database by comparing it to the first parameter, and update it with the new one.

    Find the old entry in the database by comparing it to the first parameter, and update it with the new one. Appropriate when an identity field is changed.

    Definition Classes
    MongoUpdate
  39. def updateFirst[T](entity: T)(implicit arg0: CollectionProvider[T], arg1: MongoSerialiser[T], arg2: IdentityQueryBuilder[T]): Option[T]

    Updates the first entry that matches the identity query.

    Updates the first entry that matches the identity query.

    returns

    the parameter or None if the entity was not found in the database.

    Definition Classes
    MongoUpdate
  40. final def wait(): Unit

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

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

    Definition Classes
    AnyRef
    Annotations
    @throws()

Inherited from MongoCount

Inherited from MongoAggregate

Inherited from MongoModify

Inherited from MongoCreateOrUpdate

Inherited from MongoFind

Inherited from MongoRead

Inherited from MongoDelete

Inherited from MongoUpdate

Inherited from MongoSearch

Inherited from JavaLogging

Inherited from MongoCreate

Inherited from AnyRef

Inherited from Any

Ungrouped