Cannot use Object.bsonsize

Gabriel Chamon shared this problem 5 years 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

Replies (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

Leave a Comment
 
Attach a file