2
我有一個文檔如何找到所有字段的數據類型在蒙戈
{_id:NumberLong(1),gender:"M",vip:false}.
如何使用查詢提取單個字段的類型中蒙戈.. 如何使用typeof操作:
https://docs.mongodb.org/manual/core/shell-types/
我有一個文檔如何找到所有字段的數據類型在蒙戈
{_id:NumberLong(1),gender:"M",vip:false}.
如何使用查詢提取單個字段的類型中蒙戈.. 如何使用typeof操作:
https://docs.mongodb.org/manual/core/shell-types/
> db.test.findOne()
{ "_id" : NumberLong(1), "gender" : "M", "vip" : false }
> db.test.findOne().gender
M
> typeof db.test.findOne().gender
string
例如,您可以查詢gender
字段的類型:
typeof db.getCollection('your_collection').findOne({"_id": NumberLong(1)}).gender