Scala - get BSON document size with new ReactiveMongo(2.13)

50 Views Asked by At

I want to find out the BSON document size before updating the document, using Scala and reactiveMongo - lib.

Working with the old lib(2.12) the equivalent code -

val bsonDoc = EntityBSONHandler.write(entity)
      val size = BSONDocumentBufferHandler
        .write(bsonDoc, ChannelBufferWritableBuffer())
        .toReadableBuffer()
        .size

I could not figure out the new implementation with version 2.13 or later.

Thank you.

0

There are 0 best solutions below