I have a situation where I have to get data from a stream and create a document in mongodb each time I get data from a stream. I can get the number of documents beforehand. I want to know how to determine the size of the documents on disk if and when the stream completes. But I would like to know this before I start my process. Is there a way to do this in mongodb.
I found Object.bsonsize();
but it can only find the size after a query complete.
As of right now I am taking the product of the number of objects(data) from the stream and size of each object which I assume to be uniform throughout the stream.