sealed abstract class BSONArray extends BSONValue
A BSONArray
(type 0x04
) is a indexed sequence of BSONValue.
import reactivemongo.api.bson._ BSONArray(BSONString("foo"), BSONDouble(1.2D))
- Alphabetic
- By Inheritance
- BSONArray
- BSONValue
- AnyRef
- Any
- by valueProducer
- by identityValueProducer
- by any2stringadd
- by StringFormat
- by Ensuring
- by ArrowAssoc
- Hide All
- Show All
- Public
- All
Abstract Value Members
-
abstract
def
values: IndexedSeq[BSONValue]
The BSON values
Concrete Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
- def +(other: String): String
-
def
++(values: BSONValue*): BSONArray
Returns a BSON array with the given values appended.
Returns a BSON array with the given values appended.
import reactivemongo.api.bson.{ BSONArray, BSONLong } val arr = BSONArray(1, "foo") arr ++ BSONLong(3L) // [ 1, 'foo', NumberLong(3) ]
-
def
++(arr: BSONArray): BSONArray
Returns a BSON array with the values of the given one appended.
Returns a BSON array with the values of the given one appended.
import reactivemongo.api.bson.BSONArray val arr1 = BSONArray(1, "foo") val arr2 = BSONArray(2L, "bar") arr1 ++ arr2 // [ 1, 'foo', NumberLong(2), 'bar' ]
-
def
+:(value: BSONValue): BSONArray
Returns a BSON array with the given value prepended.
Returns a BSON array with the given value prepended.
import reactivemongo.api.bson.{ BSONArray, BSONString } BSONString("foo") +: BSONArray(1L) // [ 'foo', NumberLong(1) ]
- def ->[B](y: B): (BSONArray, B)
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
final
def
asOpt[T](implicit reader: BSONReader[T]): Option[T]
Optionally parses this value as a
T
one.Optionally parses this value as a
T
one.- returns
Some
successfully parsed value, orNone
if failsimport reactivemongo.api.bson.BSONValue def foo(v: BSONValue): Option[String] = v.asOpt[String]
- Definition Classes
- BSONValue
- Annotations
- @inline()
-
final
def
asTry[T](implicit reader: BSONReader[T]): Try[T]
Tries to parse this value as a
T
one.Tries to parse this value as a
T
one.import scala.util.Try import reactivemongo.api.bson.BSONValue def foo(v: BSONValue): Try[String] = v.asTry[String]
- Definition Classes
- BSONValue
-
val
byteCode: Byte
The code indicating the BSON type for this value as Byte
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
val
code: Int
The code indicating the BSON type for this value
- def ensuring(cond: (BSONArray) ⇒ Boolean, msg: ⇒ Any): BSONArray
- def ensuring(cond: (BSONArray) ⇒ Boolean): BSONArray
- def ensuring(cond: Boolean, msg: ⇒ Any): BSONArray
- def ensuring(cond: Boolean): BSONArray
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(that: Any): Boolean
- Definition Classes
- BSONArray → AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
- def formatted(fmtstr: String): String
-
def
get(index: Int): Option[BSONValue]
Returns the BSONValue at the given
index
.Returns the BSONValue at the given
index
.If there is no such
index
,None
is returned.def secondAsString( a: reactivemongo.api.bson.BSONArray): Option[String] = a.get(1).flatMap(_.asOpt[String])
- index
the index to be found in the array (
0
being the first)
-
def
getAsOpt[T](index: Int)(implicit reader: BSONReader[T]): Option[T]
Returns the BSONValue at the given
index
, and converts it with the given implicit BSONReader.Returns the BSONValue at the given
index
, and converts it with the given implicit BSONReader.If there is no matching value, or the value could not be deserialized, or converted, returns a
None
.import reactivemongo.api.bson.BSONArray val arr = BSONArray(1, "foo") arr.getAsOpt[Int](0) // Some(1) arr.getAsOpt[Int](1) // None; "foo" not int
- index
the index to be found in the array (
0
being the first)
-
def
getAsTry[T](index: Int)(implicit reader: BSONReader[T]): Try[T]
Gets the BSONValue at the given
index
, and converts it with the given implicit BSONReader.Gets the BSONValue at the given
index
, and converts it with the given implicit BSONReader.If there is no matching value, or the value could not be deserialized, or converted, returns a
Failure
.The
Failure
holds a exceptions.BSONValueNotFoundException if the index could not be found.import reactivemongo.api.bson.BSONArray val arr = BSONArray(1, "foo") arr.getAsTry[Int](0) // Success(1) arr.getAsTry[Int](1) // Failure(BSONValueNotFoundException(..))
- index
the index to be found in the array (
0
being the first)
-
def
getAsUnflattenedTry[T](index: Int)(implicit reader: BSONReader[T]): Try[Option[T]]
Gets the BSONValue at the given
index
, and converts it with the given implicit BSONReader.Gets the BSONValue at the given
index
, and converts it with the given implicit BSONReader.If there is no matching value,
Success(None)
is returned. If there is a value, it must be valid or aFailure
is returned.import reactivemongo.api.bson.BSONArray val arr = BSONArray(1, "foo") arr.getAsUnflattenedTry[Int](0) // Success(Some(1)) arr.getAsUnflattenedTry[Int](1) // Failure(BSONValueNotFoundException(..)) arr.getAsUnflattenedTry[Int](2) // Success(None) // no value at 2
- index
the index to be found in the array (
0
being the first)
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
getOrElse[T](index: Int, default: ⇒ T)(implicit reader: BSONReader[T]): T
Returns the BSONValue at the given
index
, and converts it with the given implicit BSONReader.Returns the BSONValue at the given
index
, and converts it with the given implicit BSONReader.If there is no matching value, or the value could not be deserialized, or converted, returns the
default
value.import reactivemongo.api.bson.BSONArray val arr = BSONArray(1, "foo") arr.getOrElse[Int](0, -1) // 1 arr.getOrElse[Int](1, -1) // -1; "foo" not int
- index
the index to be found in the array (
0
being the first)
-
def
hashCode(): Int
- Definition Classes
- BSONArray → AnyRef → Any
-
def
headOption: Option[BSONValue]
The first/mandatory value, if any
-
def
isEmpty: Boolean
Indicates whether this array is empty
Indicates whether this array is empty
- Annotations
- @inline()
-
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
size: Int
The number of values
The number of values
- Annotations
- @inline()
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- BSONArray → AnyRef → Any
-
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
- @throws( ... ) @native()
- def →[B](y: B): (BSONArray, B)