object BsonMagnets
A magnet pattern implementation enforcing the validity of user provided native values being able to be converted into BsonValues.
- Attributes
- protected
- Since
1.0
- Alphabetic
- By Inheritance
- BsonMagnets
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Type Members
- sealed trait CanBeBsonElement extends AnyRef
Represents a single BsonElement
Represents a single BsonElement
This is essentially a
(String, BsonValue)
key value pair. Any pair of(String, T)
where typeT
has a BsonTransformer in scope into a BsonValue is also a valid pair. - sealed trait CanBeBsonElements extends AnyRef
Represents a sequence of BsonElements
Represents a sequence of BsonElements
This is essentially a
Iterable[(String, BsonValue)]
of key value pairs. Any pair of(String, T)
where typeT
has a BsonTransformer in scope into a BsonValue is also a valid pair. - sealed trait CanBeBsonValue extends AnyRef
Represents any single BsonValue
Represents any single BsonValue
This is a
BsonValue
or any type ofT
that has a BsonTransformer in scope for the given type.
Value Members
- implicit def iterableToCanBeBsonElements[T](elems: Iterable[(String, T)])(implicit transformer: BsonTransformer[T]): CanBeBsonElements
Implicitly converts any iterable of key/value pairs into a CanBeBsonElements.
Implicitly converts any iterable of key/value pairs into a CanBeBsonElements.
- T
the type of the values
- elems
the iterable of key/value pairs
- transformer
the implicit transformer for the values
- returns
CanBeBsonElements representing the key/value pairs
- implicit def singleToCanBeBsonValue[T](v: T)(implicit transformer: BsonTransformer[T]): CanBeBsonValue
Implicitly converts type
T
to a BsonValue as long as there is a BsonTransformer in scope for the given type.Implicitly converts type
T
to a BsonValue as long as there is a BsonTransformer in scope for the given type.- T
the type of the initial value
- v
the initial value
- transformer
implicitly provided BsonTransformer that needs to be in scope for type
T
to be transformed into a BsonValue- returns
A CanBeBsonValue that holds the transformed BsonValue
- implicit def tupleToCanBeBsonElement[T](kv: (String, T))(implicit transformer: BsonTransformer[T]): CanBeBsonElement
Implicitly converts key/value tuple of type (String, T) into a
CanBeBsonElement
Implicitly converts key/value tuple of type (String, T) into a
CanBeBsonElement
- T
the type of the value
- kv
the key value pair
- transformer
the implicit BsonTransformer for the value
- returns
a CanBeBsonElement representing the key/value pair
This is the documentation for the MongoDB Scala driver.
Driver structure
The mongodb scala driver.
To get started you need a MongoClient instance, either from a connection string or via a org.mongodb.scala.MongoClientSettings.
Notable packages include: