Cannot use Object.bsonsize

Gabriel Chamon shared this problem 11 months ago
Solved

First of all, thanks for this product!


I am writing a script to clean documents with null or empty values and I need to assert the size diference with the saved difference so I can be sure that the modifications are actually worth it. I cannot assert document size with Object.bsonsize though, as the function is not defined

Thanks

Comments (2)

photo
1

Thank you for your bug report. We will fix the bug in the next build.

As a workaround solution, you can use calculateObjectSize, and it is equal to "Object.bsonsize."


calculateObjectSize({a:1});

Object.bsonsize({a:1});

photo
1

Fixed in 4.7.5