BSONElement

reactivemongo.api.bson.BSONElement
See theBSONElement companion class
object BSONElement

BSONElement factories and utilities.

Attributes

Companion
class
Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Value members

Concrete methods

def apply(name: String, value: BSONValue): BSONElement

Create a new BSONElement.

Create a new BSONElement.

import reactivemongo.api.bson.{ BSONElement, BSONLong }

BSONElement("name", BSONLong(2L))

Attributes

def apply(_name: String, _value: None.type): ElementProducer

Returns an empty ElementProducer

Returns an empty ElementProducer

Attributes

def unapply(that: Any): Option[(String, BSONValue)]

Extracts the name and BSONValue if that's a BSONElement.

Extracts the name and BSONValue if that's a BSONElement.

import reactivemongo.api.bson.{ BSONDocument, BSONElement }

def foo(doc: BSONDocument): Unit = doc.elements.foreach {
 case BSONElement(name, bson) =>
   println(s"- " + name + " = " + bson)

 case _ =>
}

Attributes

Inherited methods

def apply[T](name: String, value: T)(implicit ev: T => Producer[BSONValue]): ElementProducer

Returns a ElementProducer for the given name and value.

Returns a ElementProducer for the given name and value.

import reactivemongo.api.bson.{ BSONElement, ElementProducer }

val e1: ElementProducer = BSONElement("name1", 1) // BSONInteger
val e2 = BSONElement("name2", "foo") // BSONString

Attributes

Inherited from:
BSONElementLowPriority (hidden)

Implicits

Inherited implicits

import reactivemongo.api.bson.{ BSONElement, BSONInteger }

val e: BSONElement = "foo" -> BSONInteger(1)
// tuple as BSONElement("foo", BSONInteger(1))

Attributes

Inherited from:
BSONElementLowPriority (hidden)