如何在MonogoDB Collection中查找特定文档的大小? [英] How to find the fhe size of the specific Document in MonogoDB Collection?

查看:86
本文介绍了如何在MonogoDB Collection中查找特定文档的大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的MonoDB集合中有10万个文档,document({id : '789736363828292'})有20k个文档/记录.我想找到该特定文档所利用的内存.

I have 100k documents in an MonoDB Collection, the document({id : '789736363828292'}) has 20k Documents/Records. I would like find the memory utilized by that particular document.

请帮助我在MongoDB控制台中找到以MB为单位的内存大小.

Please help me to find the memory size in MB in MongoDB console.

推荐答案

您可以在MongoShell中使用Object.bsonsize,它将返回一个文档的BSON大小(以字节为单位).试试

You can use Object.bsonsize in MongoShell which will return a BSON size (in bytes) of one document. Try

Object.bsonsize(db.col.findOne({id : '789736363828292'}))

这篇关于如何在MonogoDB Collection中查找特定文档的大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆