object BSONArray
BSONArray utilities
import reactivemongo.api.bson.{ BSONArray, BSONString } BSONArray("foo", 1) match { case BSONArray(BSONString(s) +: _) => s == "foo" case _ => false }
- Alphabetic
- By Inheritance
- BSONArray
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def apply(values: bson.BaseColl[BSONValue]): BSONArray
Creates a new BSONArray containing all the
values
in the givenIterable
.Creates a new BSONArray containing all the
values
in the givenIterable
.import reactivemongo.api.bson.{ BSONArray, BSONLong, BSONString } BSONArray(List(BSONString("foo"), BSONLong(1L))) // [ 'foo', NumberLong(1) ]
- def apply(values: IndexedSeq[BSONValue]): BSONArray
Creates a new BSONArray containing all the
values
in the given sequence.Creates a new BSONArray containing all the
values
in the given sequence.import reactivemongo.api.bson.{ BSONArray, BSONLong, BSONString } BSONArray(Seq(BSONString("foo"), BSONLong(1L))) // [ 'foo', NumberLong(1) ]
- def apply(values: Producer[BSONValue]*): BSONArray
Creates a new BSONArray containing all the
values
.Creates a new BSONArray containing all the
values
. In case of conversion error for a field value, the field is ignored.reactivemongo.api.bson.BSONArray("foo", 1L) // [ 'foo', NumberLong(1) ]
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- val empty: BSONArray
An empty BSONArray.
An empty BSONArray.
import reactivemongo.api.bson.{ BSONArray, BSONString } val initial = BSONArray.empty // [] initial ++ BSONString("lorem") // [ 'lorem' ]
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- 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()
- def pretty(array: BSONArray): String
Returns a String representing the given BSONArray.
Returns a String representing the given BSONArray.
import reactivemongo.api.bson.BSONArray BSONArray pretty BSONArray("foo", 1L) // "[ 'foo', NumberLong(1) ]"
- def safe(values: Producer[BSONValue]*): Try[BSONArray]
Creates a new BSONArray containing all the
values
.Creates a new BSONArray containing all the
values
. Fails if any error occurs while converting the values.reactivemongo.api.bson.BSONArray.safe("foo", 1L) // Success: [ 'foo', NumberLong(1) ]
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- def unapply(that: Any): Option[IndexedSeq[BSONValue]]
Extracts the values sequence if
that
's a BSONArray.Extracts the values sequence if
that
's a BSONArray.import reactivemongo.api.bson.{ BSONArray, BSONValue } def foo(input: BSONValue): Unit = input match { case BSONArray(vs) => pretty(vs) case _ => println("Not a BSON array") } def bar(arr: BSONArray): Unit = arr match { // with splat pattern case BSONArray(Seq(requiredFirst, other @ _*)) => println(s"first = \$requiredFirst") pretty(other) case _ => println("BSON array doesn't match") } def pretty(values: Seq[BSONValue]): Unit = println(values.map(BSONValue.pretty).mkString(", "))
- Annotations
- @inline()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()