deserialize static method

dynamic deserialize(
  1. BsonBinary buffer, {
  2. SerializationType serializationType = SerializationType.bson,
  3. dynamic typeByte = bsonDataObject,
  4. bool relaxed = false,
})

Implementation

static dynamic deserialize(BsonBinary buffer,
    {SerializationType serializationType = SerializationType.bson,
    typeByte = bsonDataObject,
    bool relaxed = false}) {
  buffer.offset = 0;
  var bsonObject = BsonObject.fromTypeByteAndBuffer(typeByte, buffer);
  if (serializationType == SerializationType.ejson) {
    return bsonObject.eJson(relaxed: relaxed);
  }
  return bsonObject.value;
}