EXPERIMENTAL
Creates a new BSONDocument containing the unique elements from the given collection (only one instance of a same element, same name & value, is kept).
Creates a new BSONDocument containing the unique elements from the given collection (only one instance of a same element, same name & value, is kept).
import reactivemongo.api.bson._ BSONDocument(Seq( "foo" -> BSONInteger(1), "bar" -> BSONString("lorem"))) // { 'foo': 1, 'bar': 'lorem' }
Creates a new BSONDocument containing the unique elements from the given collection (only one instance of a same element, same name & value, is kept).
Creates a new BSONDocument containing the unique elements from the given collection (only one instance of a same element, same name & value, is kept).
reactivemongo.api.bson.BSONDocument( "foo" -> 1, "bar" -> "lorem" ) // => { 'foo': 1, 'bar': 'lorem' }
An empty BSONDocument.
Returns a String representing the given BSONDocument.
Returns a String representing the given BSONDocument.
import reactivemongo.api.bson.BSONDocument def printDoc(doc: BSONDocument): String = BSONDocument.pretty(doc)
EXPERIMENTAL: Creates a new BSONDocument containing the elements deduplicated by name from the given collection (only the last is kept for a same name).
EXPERIMENTAL: Creates a new BSONDocument containing the elements deduplicated by name from the given collection (only the last is kept for a same name). Then append operations on such document will maintain element unicity by field name (see BSONStrictDocument.++
).
import reactivemongo.api.bson._ BSONDocument.strict(Seq( "foo" -> BSONInteger(1), "foo" -> BSONString("lorem"))) // { 'foo': 1 }
EXPERIMENTAL: Creates a new BSONDocument containing the elements deduplicated by name from the given collection (only the last is kept for a same name).
EXPERIMENTAL: Creates a new BSONDocument containing the elements deduplicated by name from the given collection (only the last is kept for a same name). Then append operations on such document will maintain element unicity by field name (see BSONStrictDocument.++
).
reactivemongo.api.bson.BSONDocument("foo" -> 1, "bar" -> 2, "foo" -> 3) // => { "foo": 1, "bar": 2 } : No "foo": 3
Extracts the elements if that
's a BSONDocument.
Extracts the elements if that
's a BSONDocument.
import reactivemongo.api.bson.{ BSONDocument, BSONValue } def names(v: BSONValue): Seq[String] = v match { case BSONDocument(elements) => elements.map(_.name) case _ => Seq.empty[String] }
BSONDocument factories & utilities.