t

reactivemongo.api

CollectionMetaCommands

trait CollectionMetaCommands extends AnyRef

A mixin that provides commands about this Collection itself.

Self Type
CollectionMetaCommands with Collection
Annotations
@deprecated
Deprecated

(Since version 0.19.8) Internal: will be made private

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. CollectionMetaCommands
  2. AnyRef
  3. Any
Implicitly
  1. by any2stringadd
  2. by StringFormat
  3. by Ensuring
  4. by ArrowAssoc
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. def +(other: String): String
    Implicit
    This member is added by an implicit conversion from CollectionMetaCommands toany2stringadd[CollectionMetaCommands] performed by method any2stringadd in scala.Predef.
    Definition Classes
    any2stringadd
  4. def ->[B](y: B): (CollectionMetaCommands, B)
    Implicit
    This member is added by an implicit conversion from CollectionMetaCommands toArrowAssoc[CollectionMetaCommands] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
    Annotations
    @inline()
  5. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  6. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  7. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  8. 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.

    import scala.concurrent.{ ExecutionContext, Future }
    
    def capColl(coll: reactivemongo.api.bson.collection.BSONCollection)(
      implicit ec: ExecutionContext): Future[Unit] =
      coll.convertToCapped(size = 10L, maxDocuments = Some(100))
    size

    the size of the collection (number of bytes)

    maxDocuments

    the maximum number of documents this capped collection can contain

  9. def create(failsIfExists: Boolean = false)(implicit ec: ExecutionContext): Future[Unit]

    Creates this collection.

    Creates this collection.

    import scala.concurrent.{ ExecutionContext, Future }
    import reactivemongo.api.CollectionMetaCommands
    
    def createIfNotExists(coll: CollectionMetaCommands)(
      implicit ec: ExecutionContext): Future[Unit] =
      coll.create(failsIfExists = true)
    failsIfExists

    if true fails if the collection already exists (default: false)

  10. 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.

    import scala.concurrent.ExecutionContext
    
    import reactivemongo.api.CollectionMetaCommands
    import reactivemongo.api.commands.CommandError
    
    def createColl(
      coll: CollectionMetaCommands)(implicit ec: ExecutionContext) =
      coll.create().recover {
        case CommandError.Code(48) => // NamespaceExists
          println(s"Collection \${coll} already exists")
      }
  11. 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.

    import scala.concurrent.{ ExecutionContext, Future }
    
    def capped(coll: reactivemongo.api.bson.collection.BSONCollection)(
      implicit ec: ExecutionContext): Future[Unit] =
      coll.createCapped(size = 10, maxDocuments = Some(100))
    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 _id field. By default, regular collections will have an indexed _id field, in contrast to capped collections. This MongoDB option is deprecated and will be removed in a future release.

    See also

    convertToCapped

  12. 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 failIfNotFound is 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.

    import scala.concurrent.{ ExecutionContext, Future }
    import reactivemongo.api.CollectionMetaCommands
    
    def dropIfNotFound(coll: CollectionMetaCommands)(
      implicit ec: ExecutionContext): Future[Boolean] =
      coll.drop(failIfNotFound = true)
    failIfNotFound

    the flag to request whether it should fail

    Annotations
    @silent(".*DropCollectionResult.*")
  13. def ensuring(cond: (CollectionMetaCommands) => Boolean, msg: => Any): CollectionMetaCommands
    Implicit
    This member is added by an implicit conversion from CollectionMetaCommands toEnsuring[CollectionMetaCommands] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  14. def ensuring(cond: (CollectionMetaCommands) => Boolean): CollectionMetaCommands
    Implicit
    This member is added by an implicit conversion from CollectionMetaCommands toEnsuring[CollectionMetaCommands] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  15. def ensuring(cond: Boolean, msg: => Any): CollectionMetaCommands
    Implicit
    This member is added by an implicit conversion from CollectionMetaCommands toEnsuring[CollectionMetaCommands] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  16. def ensuring(cond: Boolean): CollectionMetaCommands
    Implicit
    This member is added by an implicit conversion from CollectionMetaCommands toEnsuring[CollectionMetaCommands] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  17. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  18. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  19. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  20. def formatted(fmtstr: String): String
    Implicit
    This member is added by an implicit conversion from CollectionMetaCommands toStringFormat[CollectionMetaCommands] performed by method StringFormat in scala.Predef.
    Definition Classes
    StringFormat
    Annotations
    @inline()
  21. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  22. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  23. def indexesManager(implicit ec: ExecutionContext): Aux[Pack]

    Returns an index manager for this collection.

    Returns an index manager for this collection.

    import scala.concurrent.{ ExecutionContext, Future }
    import reactivemongo.api.CollectionMetaCommands
    
    def listIndexes(coll: CollectionMetaCommands)(
      implicit ec: ExecutionContext): Future[List[String]] =
      coll.indexesManager.list().map(_.flatMap { idx =>
        idx.name.toList
      })
  24. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  25. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  26. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  27. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  28. def stats(scale: Int)(implicit ec: ExecutionContext): Future[CollStatsResult]

    Returns various information about this collection.

    Returns various information about this collection.

    import scala.concurrent.{ ExecutionContext, Future }
    
    def getSize(coll: reactivemongo.api.bson.collection.BSONCollection)(
      implicit ec: ExecutionContext): Future[Double] =
      coll.stats(scale = 1024).map(_.size)
    scale

    the scale factor (for example, to get all the sizes in kilobytes)

  29. def stats()(implicit ec: ExecutionContext): Future[CollStatsResult]

    Returns various information about this collection.

    Returns various information about this collection.

    import scala.concurrent.{ ExecutionContext, Future }
    
    def isCapped(coll: reactivemongo.api.bson.collection.BSONCollection)(
      implicit ec: ExecutionContext): Future[Boolean] =
      coll.stats().map(_.capped)
  30. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  31. def toString(): String
    Definition Classes
    AnyRef → Any
  32. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  33. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  34. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()

Deprecated Value Members

  1. 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.

    Annotations
    @deprecated
    Deprecated

    (Since version 0.12.0) Use drop(Boolean)

  2. 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 to already exists, then drops that collection before renaming this one

    returns

    A failure if the dropExisting option is false and the target collection already exists.

    Annotations
    @deprecated
    Deprecated

    (Since version 0.12.4) Use reactivemongo.api.DBMetaCommands.renameCollection on the admin database instead.

  3. def [B](y: B): (CollectionMetaCommands, B)
    Implicit
    This member is added by an implicit conversion from CollectionMetaCommands toArrowAssoc[CollectionMetaCommands] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
    Annotations
    @deprecated
    Deprecated

    (Since version 2.13.0) Use -> instead. If you still wish to display it as one character, consider using a font with programming ligatures such as Fira Code.

Inherited from AnyRef

Inherited from Any

Inherited by implicit conversion any2stringadd fromCollectionMetaCommands to any2stringadd[CollectionMetaCommands]

Inherited by implicit conversion StringFormat fromCollectionMetaCommands to StringFormat[CollectionMetaCommands]

Inherited by implicit conversion Ensuring fromCollectionMetaCommands to Ensuring[CollectionMetaCommands]

Inherited by implicit conversion ArrowAssoc fromCollectionMetaCommands to ArrowAssoc[CollectionMetaCommands]

Ungrouped