Skip to content

Kotlin BSON • Multiplatform abstraction for different BSON implementationsopensavvy.ktmongo.bsonBsonPathRootget

get

open operator override fun get(field: String): BsonPath.PathOrSelector

Points to a field in a Bson document.

Example

BsonPath["foo"]         // $.foo
BsonPath["foo"]["bar"]  // $.foo.bar
open operator override fun get(index: Int): BsonPath.PathOrSelector

Points to the element at index in a BsonArray.

Example

BsonPath[0]         // $[0]
BsonPath["foo"][1]  // $.foo[1], the first element
BsonPath["foo"][-1] // $.foo[-1], the very least element