【发布时间】:2015-12-31 11:08:30
【问题描述】:
bson文档的size()函数返回的int值是字节数吗? (无法找到此 API 的详细信息)。
如何获取 bson 文档的大小(以字节为单位)?这是我的代码。
import org.bson.Document;
MongoDatabase db...;
MongoCollection<Document> mongoCollection = db.getCollection(...);
MongoCursor<Document> cursor = mongoCollection.find().iterator();
Document doc = cursor.next();
int size = doc.size(); // does this return number of bytes
// how to get size of doc in bytes?
【问题讨论】:
-
@Magnus 寻找 org.bson.Document 的大小
标签: mongodb mongodb-java bson