The BSONUtil class
When accessing BSON objects, you may find it handy to use the BSONUtil class, which provides a number of convenient methods.
You can access this class by adding the following line of code to your filter:
const BSONUtil = Java.type("com.galliumdata.server.handler.mongo.BSONUtil");
The name of the constant is up to you, of course, but the examples in this documentation will use the name BSONUtil.
object decodeBSON(byte bytes)
byte encodeBSON(object obj)
Encodes the given object into a byte array.
int getObjectSize(object obj)
Returns the size, in bytes, of the given BSON object.
boolean bsonHasProperty(object obj, String path)
Returns true if the given BSON object defines a property corresponding to the given path, which is one or more property name divided by periods, e.g. address.street.number
object getBsonProperty(object obj, String path)
Returns the value of the property designated by the path, which is a JSON Path-like expression, e.g. attr1.attr2.attr3
boolean bsonValueEquals(BsonValue bsonValue, Object val)