0

I am new to MongoDB and am trying to retrieve the size of a single document from a database.

The database is named "enron" The collection is named "email"

I tried:

Object.bsonsize(db.email.findOne())

I also tried:

Object.bsonsize(db.enron.findOne())

But it only returns 0. How can I get the size of a document? Thank you!

  • Does this answer your question? [How to get the size of single document in Mongodb?](https://stackoverflow.com/questions/22008822/how-to-get-the-size-of-single-document-in-mongodb) – D. SM Oct 30 '20 at 00:42

1 Answers1

0

Here is the related question How to get the size of a single document in MongoDB?

Tim Kozak
  • 4,026
  • 39
  • 44
  • I appreciate the link. However, I tried using Object.bsonsize(db.enron.findOne({type:"auto"})) and I still get 0 as the output. Any idea why thats happening? –  Oct 29 '20 at 10:34
  • I have not. What is the aggregate approach? –  Oct 29 '20 at 11:05
  • https://stackoverflow.com/a/61452145/788798 this one – Tim Kozak Oct 29 '20 at 11:10