reactivemongo.api.collections

default

package default

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. default
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Type Members

  1. case class BSONCollection(db: DB, name: String, failoverStrategy: FailoverStrategy) extends GenericCollection[BSONDocument, BSONDocumentReader, BSONDocumentWriter] with BSONGenericHandlers with CollectionMetaCommands with Product with Serializable

    The default implementation of Collection.

    The default implementation of Collection.

    object Samples {
    
    val connection = MongoConnection(List("localhost"))
    
    // Gets a reference to the database "plugin"
    val db = connection("plugin")
    
    // Gets a reference to the collection "acoll"
    // By default, you get a BSONCollection.
    val collection = db("acoll")
    
    def listDocs() = {
      // Select only the documents which field 'firstName' equals 'Jack'
      val query = BSONDocument("firstName" -> "Jack")
      // select only the field 'lastName'
      val filter = BSONDocument(
        "lastName" -> 1,
        "_id" -> 0)
    
      // Get a cursor of BSONDocuments
      val cursor = collection.find(query, filter).cursor[BSONDocument]
      // Let's enumerate this cursor and print a readable representation of each document in the response
      cursor.enumerate().apply(Iteratee.foreach { doc =>
        println("found document: " + BSONDocument.pretty(doc))
      })
    
      // Or, the same with getting a list
      val cursor2 = collection.find(query, filter).cursor[BSONDocument]
      val futureList = cursor.collect[List]()
      futureList.map { list =>
        list.foreach { doc =>
          println("found document: " + BSONDocument.pretty(doc))
        }
      }
    }
    }
  2. sealed trait BSONConverters extends AnyRef

    Attributes
    protected
  3. case class BSONDocumentReaderAsBufferReader[T](reader: BSONDocumentReader[T]) extends BufferReader[T] with Product with Serializable

  4. trait BSONGenericHandlers extends GenericHandlers[BSONDocument, BSONDocumentReader, BSONDocumentWriter]

  5. case class BSONQueryBuilder(collection: Collection, failover: FailoverStrategy, queryOption: Option[BSONDocument] = None, sortOption: Option[BSONDocument] = None, projectionOption: Option[BSONDocument] = None, hintOption: Option[BSONDocument] = None, explainFlag: Boolean = false, snapshotFlag: Boolean = false, commentString: Option[String] = None, options: QueryOpts = QueryOpts()) extends GenericQueryBuilder[BSONDocument, BSONDocumentReader, BSONDocumentWriter] with BSONConverters with BSONGenericHandlers with Product with Serializable

Inherited from AnyRef

Inherited from Any

Ungrouped