Export a mongodb collection that also brings the document size

Asked

Viewed 51 times

1

I have the export of a Collection that owns some documents, I need to export one of these documents and its size. I tried something of that nature:

mongoexport -d test -c records -q '{ a: { $gte: 3 } }' --out exportdir/myRecords.json

Didn’t happen what I need.

Is there any function that returns the size of a document in mongodb Collection?

  • "size" you refer to the amount of records (root) or size in bytes?

  • I mean the amount of records!

1 answer

1


Carlos the command that returns the number of records is the

db.collection.count()

Browser other questions tagged

You are not signed in. Login or sign up in order to post.