final class BSONCollection extends Product with GenericCollection[BSONSerializationPack.type] with Serializable with Serializable
- Annotations
- @SerialVersionUID()
- Alphabetic
- By Inheritance
- BSONCollection
- Serializable
- Serializable
- GenericCollection
- HintFactory
- GenericCollectionWithQueryBuilder
- GenericCollectionMetaCommands
- Aggregator
- DistinctOp
- CountOp
- DeleteOps
- UpdateOps
- InsertOps
- ImplicitCommandHelpers
- CollectionMetaCommands
- GenericCollectionWithCommands
- Collection
- Product
- Equals
- AnyRef
- Any
- by any2stringadd
- by StringFormat
- by Ensuring
- by ArrowAssoc
- Hide All
- Show All
- Public
- All
Instance Constructors
- new BSONCollection(db: DB, name: String, failoverStrategy: FailoverStrategy, readPreference: ReadPreference)
Type Members
-
sealed
trait
DeleteBuilder extends AnyRef
Builder for delete operations.
Builder for delete operations.
- Definition Classes
- DeleteOps
-
sealed
trait
InsertBuilder[T] extends AnyRef
Builder for insert operations.
Builder for insert operations.
- Definition Classes
- InsertOps
-
type
AggregationFramework = AggregationFramework.type
Alias for type of the aggregation framework, depending on the type of the collection.
Alias for type of the aggregation framework, depending on the type of the collection.
- Definition Classes
- GenericCollection
- See also
-
final
class
Aggregator[T, AC[_] <: Cursor[_]] extends AnyRef
- Definition Classes
- Aggregator
-
final
class
AggregatorContext[T] extends AnyRef
- Definition Classes
- Aggregator
-
final
class
CollectionQueryBuilder extends GenericQueryBuilder[GenericCollection.pack.type]
- Attributes
- protected
- Definition Classes
- GenericCollectionWithQueryBuilder
-
type
PipelineOperator = commands.bson.BSONAggregationFramework.PipelineOperator
Alias for reactivemongo.api.commands.AggregationFramework.PipelineOperator
- Definition Classes
- GenericCollection
-
sealed
trait
UpdateBuilder extends AnyRef
Builder for update operations.
Builder for update operations.
- Definition Classes
- UpdateOps
-
trait
ImplicitlyDocumentProducer extends AnyRef
- Definition Classes
- ImplicitCommandHelpers
Value Members
-
object
DeleteCommand extends DeleteCommand[pack.type]
- Definition Classes
- DeleteOps
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
def
+(other: String): String
- Implicit
- This member is added by an implicit conversion from BSONCollection to any2stringadd[BSONCollection] performed by method any2stringadd in scala.Predef.
- Definition Classes
- any2stringadd
-
def
->[B](y: B): (BSONCollection, B)
- Implicit
- This member is added by an implicit conversion from BSONCollection to ArrowAssoc[BSONCollection] performed by method ArrowAssoc in scala.Predef.
- Definition Classes
- ArrowAssoc
- Annotations
- @inline()
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
val
BatchCommands: BSONBatchCommands.type
- Definition Classes
- BSONCollection → GenericCollection
-
def
MissingMetadata(): ConnectionNotInitialized
- Attributes
- protected
- Definition Classes
- GenericCollection
- Annotations
- @inline()
-
def
aggregateWith[T](explain: Boolean = false, allowDiskUse: Boolean = false, bypassDocumentValidation: Boolean = false, readConcern: Option[ReadConcern] = None, readPreference: ReadPreference = ReadPreference.primary, batchSize: Option[Int] = None)(f: (AggregationFramework) ⇒ (PipelineOperator, List[PipelineOperator]))(implicit reader: Reader[T], cp: CursorProducer[T]): ProducedCursor
Aggregates the matching documents.
Aggregates the matching documents.
- T
The type of the result elements. An implicit
Reader[T]typeclass for handling it has to be in the scope.- explain
if true indicates to return the information on the processing of the pipeline
- allowDiskUse
if true enables writing to temporary files
- bypassDocumentValidation
if true enables to bypass document validation during the operation
- readConcern
the read concern
- readPreference
the read preference for the result (default: primary)
- batchSize
the batch size (for the aggregation cursor; if
Noneuse the default one)- f
the function to create the aggregation pipeline using the aggregation framework depending on the collection type
- reader
the result reader
- Definition Classes
- GenericCollection
-
def
aggregatorContext[T](firstOperator: PipelineOperator, otherOperators: List[PipelineOperator] = Nil, explain: Boolean = false, allowDiskUse: Boolean = false, bypassDocumentValidation: Boolean = false, readConcern: Option[ReadConcern] = None, readPreference: ReadPreference = ReadPreference.primary, batchSize: Option[Int] = None)(implicit reader: Reader[T]): AggregatorContext[T]
Aggregates the matching documents.
Aggregates the matching documents.
import scala.concurrent.Future import scala.concurrent.ExecutionContext.Implicits.global import reactivemongo.bson._ import reactivemongo.api.collections.bson.BSONCollection def populatedStates(cities: BSONCollection): Future[List[BSONDocument]] = { import cities.BatchCommands.AggregationFramework import AggregationFramework.{ Group, Match, SumField } cities.aggregatorContext[BSONDocument](Group(BSONString("$state"))( "totalPop" -> SumField("population")), List( Match(document("totalPop" -> document("$gte" -> 10000000L))))). prepared.cursor.collect[List]() }
- T
The type of the result elements. An implicit
Reader[T]typeclass for handling it has to be in the scope.- firstOperator
the first aggregation operator of the pipeline
- otherOperators
the sequence of MongoDB aggregation operations
- explain
if true indicates to return the information on the processing of the pipeline
- allowDiskUse
if true enables writing to temporary files
- bypassDocumentValidation
if true enables to bypass document validation during the operation
- readConcern
the read concern
- readPreference
the read preference for the result
- reader
the result reader
- Definition Classes
- GenericCollection
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
def
convertToCapped(size: Long, maxDocuments: Option[Int])(implicit ec: ExecutionContext): Future[Unit]
Converts this collection to a capped one.
Converts this collection to a capped one.
- size
the size of the collection (number of bytes)
- maxDocuments
the maximum number of documents this capped collection can contain
- Definition Classes
- CollectionMetaCommands
-
def
count(selector: Option[Document], limit: Option[Int], skip: Int, hint: Option[Hint[pack.type]], readConcern: ReadConcern)(implicit ec: ExecutionContext): Future[Long]
Counts the matching documents.
Counts the matching documents.
- selector
the document selector
- limit
the maximum number of matching documents to count
- skip
the number of matching documents to skip before counting
- hint
the index to use (either the index name or the index document; see
hint(..))- readConcern
the read concern
- Definition Classes
- GenericCollection
- See also
-
def
countDocuments(query: Option[Document], limit: Option[Int], skip: Int, hint: Option[Hint[pack.type]], readConcern: ReadConcern)(implicit ec: ExecutionContext): Future[Long]
- Attributes
- protected
- Definition Classes
- CountOp
-
def
create()(implicit ec: ExecutionContext): Future[Unit]
Creates this collection.
Creates this collection.
The returned future will be completed with an error if this collection already exists.
coll.create().recover { case CommandError.Code(48 /*NamespaceExists*/ ) => println(s"Collection ${coll.fullCollectionName} already exists") }- Definition Classes
- CollectionMetaCommands
-
def
createCapped(size: Long, maxDocuments: Option[Int], autoIndexId: Boolean = false)(implicit ec: ExecutionContext): Future[Unit]
Creates this collection as a capped one.
Creates this collection as a capped one.
The returned future will be completed with an error if this collection already exists.
- size
the size of the collection (number of bytes)
- maxDocuments
the maximum number of documents this capped collection can contain
- autoIndexId
If true should automatically add an index on the
_idfield. By default, regular collections will have an indexed_idfield, in contrast to capped collections. This MongoDB option is deprecated and will be removed in a future release.
- Definition Classes
- CollectionMetaCommands
-
def
createView(name: String, operator: PipelineOperator, pipeline: Seq[PipelineOperator], collation: Option[Collation] = None)(implicit ec: ExecutionContext): Future[Unit]
Creates a view on this collection, using an aggregation pipeline.
Creates a view on this collection, using an aggregation pipeline.
import coll.BatchCommands.AggregationFramework import AggregationFramework.{ Group, Match, SumField } // See http://docs.mongodb.org/manual/tutorial/aggregation-zip-code-data-set/#return-states-with-populations-above-10-million // Create 'myview' coll.createView( name = "myview", operator = Group(BSONString(f"$$state"))( "totalPop" -> SumField("population")), pipeline = Seq( Match(document("totalPop" -> document(f"$$gte" -> 10000000L))))) // Then the view can be resolved as any collection // (but won't be writeable) val view: BSONCollection = db("myview")
- name
the name of the view to be created
- operator
the first (required) operator for the aggregation pipeline
- pipeline
the other pipeline operators
- collation
the view collation
- Definition Classes
- GenericCollectionMetaCommands
- See also
-
val
db: DB
The database which this collection belong to.
The database which this collection belong to.
- Definition Classes
- BSONCollection → Collection
-
def
defaultCursorBatchSize: Int
- Attributes
- protected
- Definition Classes
- GenericCollection
- Annotations
- @inline()
-
def
delete[S](ordered: Boolean = true, writeConcern: WriteConcern = writeConcern): DeleteBuilder
Deletes the matching document(s).
Deletes the matching document(s).
- ordered
the ordered behaviour
- writeConcern
the writer concern to be used
- Definition Classes
- GenericCollection
-
def
distinct[T, M[_] <: Iterable[_]](key: String, query: Option[Document], readConcern: ReadConcern, collation: Option[Collation])(implicit reader: NarrowValueReader[T], ec: ExecutionContext, cbf: CanBuildFrom[M[_], T, M[T]]): Future[M[T]]
Returns the distinct values for a specified field across a single collection.
Returns the distinct values for a specified field across a single collection.
- T
the element type of the distinct values
- M
the container, that must be a scala.collection.Iterable
- key
the field for which to return distinct values
- query
the document selector, that specifies the documents from which to retrieve the distinct values.
- readConcern
the read concern
- collation
the collation
val distinctStates = collection.distinct[String, Set]( "state", None, ReadConcern.Local, None)
- Definition Classes
- GenericCollection
-
def
distinctDocuments[T, M[_] <: Iterable[_]](key: String, query: Option[Document], readConcern: ReadConcern, collation: Option[Collation])(implicit reader: NarrowValueReader[T], ec: ExecutionContext, cbf: CanBuildFrom[M[_], T, M[T]]): Future[M[T]]
- Attributes
- protected
- Definition Classes
- DistinctOp
-
def
drop(failIfNotFound: Boolean)(implicit ec: ExecutionContext): Future[Boolean]
Drops this collection.
Drops this collection.
If the collection existed and is successfully dropped, the returned future will be completed with true.
If
failIfNotFoundis false and the collection doesn't exist, the returned future will be completed with false.Otherwise in case, the future will be completed with the encountered error.
- Definition Classes
- CollectionMetaCommands
-
def
ensuring(cond: (BSONCollection) ⇒ Boolean, msg: ⇒ Any): BSONCollection
- Implicit
- This member is added by an implicit conversion from BSONCollection to Ensuring[BSONCollection] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
-
def
ensuring(cond: (BSONCollection) ⇒ Boolean): BSONCollection
- Implicit
- This member is added by an implicit conversion from BSONCollection to Ensuring[BSONCollection] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
-
def
ensuring(cond: Boolean, msg: ⇒ Any): BSONCollection
- Implicit
- This member is added by an implicit conversion from BSONCollection to Ensuring[BSONCollection] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
-
def
ensuring(cond: Boolean): BSONCollection
- Implicit
- This member is added by an implicit conversion from BSONCollection to Ensuring[BSONCollection] performed by method Ensuring in scala.Predef.
- Definition Classes
- Ensuring
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
val
failoverStrategy: FailoverStrategy
The default failover strategy for the methods of this collection.
The default failover strategy for the methods of this collection.
- Definition Classes
- BSONCollection → Collection
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
def
find[S, J](selector: S, projection: Option[J] = Option.empty)(implicit swriter: Writer[S], pwriter: Writer[J]): GenericQueryBuilder[pack.type]
Finds the documents matching the given criteria (selector), with the projection applied.
Finds the documents matching the given criteria (selector), with the projection applied.
- S
The type of the selector. An implicit
Writer[S]typeclass for handling it has to be in the scope.- selector
the document selector
- projection
the projection document to select only a subset of each matching documents
- swriter
the writer for the selector
- pwriter
the writer for the projection
- returns
A GenericQueryBuilder that you can use to to customize the query. You can obtain a cursor by calling the method reactivemongo.api.Cursor on this query builder.
- Definition Classes
- GenericCollection
- See also
-
def
findAndModify[S](selector: S, modifier: commands.bson.BSONFindAndModifyCommand.Modify, sort: Option[Document], fields: Option[Document], bypassDocumentValidation: Boolean, writeConcern: WriteConcern, maxTime: Option[FiniteDuration], collation: Option[Collation], arrayFilters: Seq[Document])(implicit swriter: Writer[S], ec: ExecutionContext): Future[commands.bson.BSONFindAndModifyCommand.FindAndModifyResult]
Applies a findAndModify operation.
Applies a findAndModify operation. See findAndUpdate and findAndRemove convenient functions.
val updateOp = collection.updateModifier( BSONDocument("$set" -> BSONDocument("age" -> 35))) val personBeforeUpdate: Future[Option[Person]] = collection.findAndModify(BSONDocument("name" -> "Joline"), updateOp). map(_.result[Person]) val removedPerson: Future[Option[Person]] = collection.findAndModify( BSONDocument("name" -> "Jack"), collection.removeModifier). map(_.result[Person])
- selector
the document selector
- modifier
the modify operator to be applied
- sort
the document indicating the sort criteria (default:
None)- fields
the projection fields
- writeConcern
the writer concern to be used
- collation
the collation
- swriter
the writer for the selector
- Definition Classes
- GenericCollection
-
def
findAndRemove[S](selector: S, sort: Option[Document] = None, fields: Option[Document] = None)(implicit swriter: Writer[S], ec: ExecutionContext): Future[commands.bson.BSONFindAndModifyCommand.FindAndModifyResult]
Finds some matching document, and removes it (using
findAndModify).Finds some matching document, and removes it (using
findAndModify).val removed: Future[Person] = collection.findAndRemove( BSONDocument("name" -> "Foo")).map(_.result[Person])
- S
The type of the selector. An implicit
Writer[S]typeclass for handling it has to be in the scope.- selector
the document selector
- sort
the document indicating the sort criteria
- fields
the projection fields
- swriter
the writer for the selector
- Definition Classes
- GenericCollection
-
def
findAndUpdate[S, T](selector: S, update: T, fetchNewObject: Boolean = false, upsert: Boolean = false, sort: Option[Document] = None, fields: Option[Document] = None)(implicit swriter: Writer[S], writer: Writer[T], ec: ExecutionContext): Future[commands.bson.BSONFindAndModifyCommand.FindAndModifyResult]
Finds some matching document, and updates it (using
findAndModify).Finds some matching document, and updates it (using
findAndModify).val person: Future[BSONDocument] = collection.findAndUpdate( BSONDocument("name" -> "James"), BSONDocument("$set" -> BSONDocument("age" -> 17)), fetchNewObject = true) // on success, return the update document: // { "age": 17 }
- selector
the document selector
- update
the update to be applied
- fetchNewObject
the command result must be the new object instead of the old one.
- upsert
if true, creates a new document if no document is matching, otherwise if at least one document matches, an update is applied
- sort
the document indicating the sort criteria (default:
None)- fields
the projection fields
- swriter
the writer for the selector
- writer
writerParam
- Definition Classes
- GenericCollection
-
def
formatted(fmtstr: String): String
- Implicit
- This member is added by an implicit conversion from BSONCollection to StringFormat[BSONCollection] performed by method StringFormat in scala.Predef.
- Definition Classes
- StringFormat
- Annotations
- @inline()
-
final
def
fullCollectionName: String
Gets the full qualified name of this collection.
Gets the full qualified name of this collection.
- Definition Classes
- Collection
- Annotations
- @inline()
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hint(specification: Document): Hint[pack.type]
Returns a hint for the given index
specificationdocument.Returns a hint for the given index
specificationdocument.- specification
the index specification document
- Definition Classes
- HintFactory
-
def
hint(name: String): Hint[pack.type]
Returns a hint for the given index
name.Returns a hint for the given index
name.- name
the index name
- Definition Classes
- HintFactory
-
def
indexesManager(implicit ec: ExecutionContext): CollectionIndexesManager
Returns an index manager for this collection.
Returns an index manager for this collection.
- Definition Classes
- CollectionMetaCommands
-
def
insert[T](ordered: Boolean, writeConcern: WriteConcern)(implicit arg0: Writer[T]): InsertBuilder[T]
Returns a builder for insert operations.
Returns a builder for insert operations.
- T
The type of the document to insert. An implicit
Writer[T]typeclass for handling it has to be in the scope.- ordered
the ordered behaviour
- writeConcern
the writer concern to be used
collection.insert[MyDocType](true, aWriteConcern).one(singleDoc) collection.insert[MyDocType](true, aWriteConcern).one(multiDocs)
- Definition Classes
- GenericCollection
-
def
insert[T](ordered: Boolean)(implicit arg0: Writer[T]): InsertBuilder[T]
Returns a builder for insert operations.
Returns a builder for insert operations. Uses the default write concern.
- T
The type of the document to insert. An implicit
Writer[T]typeclass for handling it has to be in the scope.- ordered
the ordered behaviour
collection.insert[MyDocType](ordered = true).one(singleDoc) collection.insert[MyDocType](ordered = true).one(multiDocs)
- Definition Classes
- GenericCollection
-
def
insert[T](document: T, writeConcern: WriteConcern = writeConcern)(implicit writer: Writer[T], ec: ExecutionContext): Future[WriteResult]
Inserts a document into the collection and waits for the reactivemongo.api.commands.WriteResult.
Inserts a document into the collection and waits for the reactivemongo.api.commands.WriteResult.
- T
The type of the document to insert. An implicit
Writer[T]typeclass for handling it has to be in the scope.- document
the document to insert
- writeConcern
the writer concern to be used
- writer
the writer to create the document to be inserted
- returns
a future reactivemongo.api.commands.WriteResult that can be used to check whether the insertion was successful
collection.insert(myDoc) // Equivalent to: collection.insert[MyDocType](true, defaultWriteConcern).one(document)
- Definition Classes
- GenericCollection
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
val
name: String
The name of the collection.
The name of the collection.
- Definition Classes
- BSONCollection → Collection
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
val
pack: BSONSerializationPack.type
- Definition Classes
- BSONCollection → GenericCollection → ImplicitCommandHelpers → GenericCollectionWithCommands
-
def
productIterator: Iterator[Any]
- Definition Classes
- Product
-
def
productPrefix: String
- Definition Classes
- Product
-
def
readConcern: ReadConcern
The default read concern
The default read concern
- Attributes
- protected
- Definition Classes
- GenericCollection
- Annotations
- @inline()
-
val
readPreference: ReadPreference
The default read preference
The default read preference
- Definition Classes
- BSONCollection → GenericCollection
-
def
runCommand[C <: CollectionCommand](command: C)(implicit writer: Writer[ResolvedCollectionCommand[C]]): CursorFetcher[pack.type, Cursor]
- Definition Classes
- GenericCollectionWithCommands
-
def
runCommand[R, C <: CollectionCommand with CommandWithResult[R]](command: C with CommandWithResult[R], readPreference: ReadPreference = self.readPreference)(implicit writer: Writer[ResolvedCollectionCommand[C]], reader: Reader[R], ec: ExecutionContext): Future[R]
- Definition Classes
- GenericCollectionWithCommands
-
def
runValueCommand[A <: AnyVal, R <: BoxedAnyVal[A], C <: CollectionCommand with CommandWithResult[R]](command: C with CommandWithResult[R with BoxedAnyVal[A]], rp: ReadPreference = self.readPreference)(implicit writer: Writer[ResolvedCollectionCommand[C]], reader: Reader[R], ec: ExecutionContext): Future[A]
- Definition Classes
- GenericCollectionWithCommands
-
def
runWithResponse[R, C <: CollectionCommand with CommandWithResult[R]](command: C with CommandWithResult[R], readPreference: ReadPreference = self.readPreference)(implicit writer: Writer[ResolvedCollectionCommand[C]], reader: Reader[R], ec: ExecutionContext): Future[ResponseResult[R]]
- Definition Classes
- GenericCollectionWithCommands
-
def
runner: CommandWithPackRunner[pack.type]
- Definition Classes
- GenericCollectionWithCommands
-
def
sibling[C <: Collection](name: String, failoverStrategy: FailoverStrategy = failoverStrategy)(implicit producer: CollectionProducer[C] = BSONCollectionProducer): C
Gets another collection in the current database.
Gets another collection in the current database. An implicit CollectionProducer[C] must be present in the scope, or it will be the default implementation (reactivemongo.api.collections.bson.BSONCollection).
- name
the name of another collection
- failoverStrategy
the failover strategy to override the default one
- Definition Classes
- Collection
-
def
stats(scale: Int)(implicit ec: ExecutionContext): Future[CollStatsResult]
Returns various information about this collection.
Returns various information about this collection.
- scale
the scale factor (for example, to get all the sizes in kilobytes)
- Definition Classes
- CollectionMetaCommands
-
def
stats()(implicit ec: ExecutionContext): Future[CollStatsResult]
Returns various information about this collection.
Returns various information about this collection.
- Definition Classes
- CollectionMetaCommands
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
- lazy val toString: String
-
implicit
lazy val
unitBoxReader: Reader[UnitBox.type]
- Attributes
- protected
- Definition Classes
- GenericCollection
-
def
update(ordered: Boolean, writeConcern: WriteConcern): UpdateBuilder
Returns an update builder.
Returns an update builder.
collection.update(ordered, writeConcern).many(updates)
- Definition Classes
- GenericCollection
-
def
update(ordered: Boolean): UpdateBuilder
Returns an update builder.
Returns an update builder.
// Equivalent to collection.update(query, update, ...) collection.update(ordered = true). one(query, update, upsert = false, multi = false)
- Definition Classes
- GenericCollection
-
def
update[S, T](selector: S, update: T, writeConcern: WriteConcern = writeConcern, upsert: Boolean = false, multi: Boolean = false)(implicit swriter: Writer[S], writer: Writer[T], ec: ExecutionContext): Future[UpdateWriteResult]
Updates one or more documents matching the given selector with the given modifier or update object.
Updates one or more documents matching the given selector with the given modifier or update object.
- S
The type of the selector. An implicit
Writer[S]typeclass for handling it has to be in the scope.- T
The type of the modifier or update object. An implicit
Writer[T]typeclass for handling it has to be in the scope.- selector
the selector object, for finding the documents to update.
- update
the modifier object (with special keys like $set) or replacement object.
- writeConcern
the writer concern to be used
- upsert
if true, creates a new document if no document is matching, otherwise if at least one document matches, an update is applied (defaults:
false)- multi
states whether the update may be done on all the matching documents (default:
false)- swriter
the writer for the selector
- writer
the writer to create the document
- returns
a future reactivemongo.api.commands.WriteResult that can be used to check whether the insertion was successful
- Definition Classes
- GenericCollection
-
def
updateModifier[U](update: U, fetchNewObject: Boolean = false, upsert: Boolean = false)(implicit updateWriter: Writer[U]): commands.bson.BSONFindAndModifyCommand.Update
Returns an update modifier, to be used with
findAndModify.Returns an update modifier, to be used with
findAndModify.- update
the update to be applied
- fetchNewObject
the command result must be the new object instead of the old one.
- upsert
if true, creates a new document if no document is matching, otherwise if at least one document matches, an update is applied
- Definition Classes
- GenericCollection
-
lazy val
version: MongoWireVersion
Upper MongoDB version (used for version checks)
Upper MongoDB version (used for version checks)
- Attributes
- protected
- Definition Classes
- GenericCollection
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
def
watchFailure[T](future: ⇒ Future[T]): Future[T]
- Attributes
- protected
- Definition Classes
- GenericCollection
-
def
withReadPreference(pref: ReadPreference): BSONCollection
Returns a new reference to the same collection, with the given read preference.
Returns a new reference to the same collection, with the given read preference.
- Definition Classes
- BSONCollection → GenericCollection
-
def
writeConcern: WriteConcern
The default write concern
The default write concern
- Attributes
- protected
- Definition Classes
- GenericCollection
- Annotations
- @inline()
-
def
writePreference: ReadPreference
The read preference for the write operations (primary)
The read preference for the write operations (primary)
- Attributes
- protected
- Definition Classes
- GenericCollection
- Annotations
- @inline()
-
def
→[B](y: B): (BSONCollection, B)
- Implicit
- This member is added by an implicit conversion from BSONCollection to ArrowAssoc[BSONCollection] performed by method ArrowAssoc in scala.Predef.
- Definition Classes
- ArrowAssoc
-
object
UpdateCommand extends UpdateCommand[GenericCollection.pack.type]
- Definition Classes
- UpdateOps
-
object
ImplicitlyDocumentProducer
- Definition Classes
- ImplicitCommandHelpers
Deprecated Value Members
-
implicit
def
PackIdentityReader: Reader[Document]
- Definition Classes
- GenericCollection
- Annotations
- @deprecated
- Deprecated
(Since version 0.16.0) Will be private/internal
-
implicit
def
PackIdentityWriter: Writer[Document]
- Definition Classes
- GenericCollection
- Annotations
- @deprecated
- Deprecated
(Since version 0.16.0) Will be private/internal
-
def
aggregateWith1[T](explain: Boolean = false, allowDiskUse: Boolean = false, bypassDocumentValidation: Boolean = false, readConcern: Option[ReadConcern] = None, readPreference: ReadPreference = ReadPreference.primary, batchSize: Option[Int] = None)(f: (AggregationFramework) ⇒ (PipelineOperator, List[PipelineOperator]))(implicit ec: ExecutionContext, reader: Reader[T], cf: CursorFlattener[Cursor], cp: CursorProducer[T]): ProducedCursor
Aggregates the matching documents.
Aggregates the matching documents.
- T
The type of the result elements. An implicit
Reader[T]typeclass for handling it has to be in the scope.- explain
if true indicates to return the information on the processing of the pipeline
- allowDiskUse
if true enables writing to temporary files
- bypassDocumentValidation
if true enables to bypass document validation during the operation
- readConcern
the read concern
- readPreference
the read preference for the result (default: primary)
- batchSize
the batch size (for the aggregation cursor; if
Noneuse the default one)- f
the function to create the aggregation pipeline using the aggregation framework depending on the collection type
- reader
the result reader
- cf
the cursor flattener (by default use the builtin one)
- Definition Classes
- GenericCollection
- Annotations
- @deprecated
- Deprecated
(Since version 0.16.0) Use aggregateWith
-
def
as[C <: Collection](failoverStrategy: FailoverStrategy = failoverStrategy)(implicit producer: CollectionProducer[C] = BSONCollectionProducer): C
Gets another implementation of this collection.
Gets another implementation of this collection. An implicit CollectionProducer[C] must be present in the scope, or it will be the default implementation (reactivemongo.api.collections.bson.BSONCollection).
- failoverStrategy
the failover strategy to override the default one
- Definition Classes
- Collection
- Annotations
- @deprecated
- Deprecated
(Since version 0.13.0) Resolve the collection from DB
-
def
canEqual(that: Any): Boolean
- Definition Classes
- BSONCollection → Equals
- Annotations
- @deprecated
- Deprecated
(Since version 0.12-RC2) No longer a case class
-
def
copy(db: DB = this.db, name: String = this.name, failoverStrategy: FailoverStrategy = this.failoverStrategy): BSONCollection
- Annotations
- @deprecated
- Deprecated
(Since version 0.12-RC2) No longer a case class
-
def
count[H](selector: Option[Document] = None, limit: Int = 0, skip: Int = 0, hint: Option[H] = None)(implicit h: (H) ⇒ commands.bson.BSONCountCommand.Hint, ec: ExecutionContext): Future[Int]
Counts the matching documents.
Counts the matching documents.
- H
The type of hint. An implicit
H => Hintconversion has to be in the scope.- selector
the document selector (default:
Noneto count all)- limit
the maximum number of matching documents to count
- skip
the number of matching documents to skip before counting
- hint
the index to use (either the index name or the index document)
- Definition Classes
- GenericCollection
- Annotations
- @deprecated
- Deprecated
(Since version 0.16.0) Use
countwithreadConcernparameter- See also
-
def
create(autoIndexId: Boolean = false)(implicit ec: ExecutionContext): Future[Unit]
- autoIndexId
DEPRECATED: If true should automatically add an index on the
_idfield. By default, regular collections will have an indexed_idfield, in contrast to capped collections. This MongoDB option is deprecated and will be removed in a future release.
- Definition Classes
- CollectionMetaCommands
- Annotations
- @deprecated
- Deprecated
(Since version 0.14.0) Use
createwithout deprecatedautoIndexId
-
def
distinct[T, M[_] <: Iterable[_]](key: String, selector: Option[Document] = None, readConcern: ReadConcern = self.readConcern)(implicit reader: NarrowValueReader[T], ec: ExecutionContext, cbf: CanBuildFrom[M[_], T, M[T]]): Future[M[T]]
- Definition Classes
- GenericCollection
- Annotations
- @deprecated
- Deprecated
(Since version 0.16.0) Use
distinctwithCollation
-
def
drop()(implicit ec: ExecutionContext): Future[Unit]
Drops this collection.
Drops this collection.
The returned future will be completed with an error if this collection does not exist.
- Definition Classes
- CollectionMetaCommands
- Annotations
- @deprecated
- Deprecated
(Since version 0.12.0) Use
drop(Boolean)
-
def
emptyCapped()(implicit ec: ExecutionContext): Future[Unit]
If this collection is capped, removes all the documents it contains.
If this collection is capped, removes all the documents it contains.
Deprecated because it became an internal command, unavailable by default.
- Definition Classes
- CollectionMetaCommands
- Annotations
- @deprecated
- Deprecated
(Since version 0.9) Deprecated because emptyCapped became an internal command, unavailable by default.
-
def
find[S, J](selector: S, projection: J)(implicit swriter: Writer[S], pwriter: Writer[J]): GenericQueryBuilder[pack.type]
Finds the documents matching the given criteria (selector), with the projection applied.
Finds the documents matching the given criteria (selector), with the projection applied.
- S
The type of the selector. An implicit
Writer[S]typeclass for handling it has to be in the scope.- selector
the document selector
- projection
the projection document to select only a subset of each matching documents
- swriter
the writer for the selector
- pwriter
the writer for the projection
- returns
A GenericQueryBuilder that you can use to to customize the query. You can obtain a cursor by calling the method reactivemongo.api.Cursor on this query builder.
- Definition Classes
- GenericCollection
- Annotations
- @deprecated
- Deprecated
(Since version 0.16.0) Use
findwith optionalprojection- See also
-
def
find[S](selector: S)(implicit swriter: Writer[S]): GenericQueryBuilder[pack.type]
Finds the documents matching the given criteria (selector).
Finds the documents matching the given criteria (selector).
- S
The type of the selector. An implicit
Writer[S]typeclass for handling it has to be in the scope.- selector
the document selector
- swriter
the writer for the selector
- returns
A GenericQueryBuilder that you can use to to customize the query. You can obtain a cursor by calling the method reactivemongo.api.Cursor on this query builder.
- Definition Classes
- GenericCollection
- Annotations
- @deprecated
- Deprecated
(Since version 0.16.0) Use
findwith optionalprojection- See also
-
def
findAndModify[S](selector: S, modifier: commands.bson.BSONFindAndModifyCommand.Modify, sort: Option[Document] = None, fields: Option[Document] = None)(implicit swriter: Writer[S], ec: ExecutionContext): Future[commands.bson.BSONFindAndModifyCommand.FindAndModifyResult]
- Definition Classes
- GenericCollection
- Annotations
- @deprecated
- Deprecated
(Since version 0.14.0) Use other
findAndModify
-
val
productArity: Int
- Definition Classes
- BSONCollection → Product
- Annotations
- @deprecated
- Deprecated
(Since version 0.12-RC2) No longer a case class
-
def
productElement(n: Int): Any
- Definition Classes
- BSONCollection → Product
- Annotations
- @deprecated
- Deprecated
(Since version 0.12-RC2) No longer a case class
-
def
remove[S](selector: S, writeConcern: WriteConcern = writeConcern, firstMatchOnly: Boolean = false)(implicit swriter: Writer[S], ec: ExecutionContext): Future[WriteResult]
- S
The type of the selector. An implicit
Writer[S]typeclass for handling it has to be in the scope.- writeConcern
the writer concern to be used
- swriter
the writer for the selector
- returns
a future reactivemongo.api.commands.WriteResult that can be used to check whether the removal was successful
// Equivalent to: collection.delete[MyDocType](true, defaultWriteConcern).one(document, limit)
- Definition Classes
- GenericCollection
- Annotations
- @deprecated
- Deprecated
(Since version 0.13.1) Use delete().one(selector, limit)
-
lazy val
removeModifier: commands.bson.BSONFindAndModifyCommand.Remove.type
Returns a removal modifier, to be used with
findAndModify.Returns a removal modifier, to be used with
findAndModify.- Definition Classes
- GenericCollection
- Annotations
- @deprecated @transient()
- Deprecated
(Since version 0.16.0) Will be private/internal
-
def
rename(to: String, dropExisting: Boolean = false)(implicit ec: ExecutionContext): Future[Unit]
Renames this collection.
Renames this collection.
- to
the new name of this collection
- dropExisting
if a collection of name
toalready exists, then drops that collection before renaming this one- returns
a failure if the dropExisting option is false and the target collection already exists
- Definition Classes
- CollectionMetaCommands
- Annotations
- @deprecated
- Deprecated
(Since version 0.12.4) Use
reactivemongo.api.DBMetaCommands.renameCollection on the admin database instead.