[英]How do I query MongoDB?
I just created a collection and am trying to query certain objects inside the document but I seem to get no results. 我刚刚创建了一个集合,并试图查询文档中的某些对象,但似乎没有任何结果。 Btw I am using Robomongo for the GUI for mongoDB.These are my documents. 顺便说一句,我正在将Robomongo用于mongoDB的GUI。这些是我的文档。
/* 1 */
{
"_id" : ObjectId("58f58ba6739e558ced008df1"),
"Inventory for NTA SAM Cards" : "Item no.",
"Item Description" : "",
"Opening QTY" : "",
"Issued QTY" : "",
"Corrupted QTY" : "",
"Closing QTY" : ""
}
/* 2 */
{
"_id" : ObjectId("58f58f23739e558ced008e3d"),
"Inventory for NTA SAM Cards" : "01",
"Item Description" : "EZ-Link SAM (Blank)",
"Opening QTY" : "165",
"Issued QTY" : "65",
"Corrupted QTY" : "0",
"Closing QTY" : "100",
"Remarks" : "Received 100 blank SAMS from Geraldine on 4/1/15"
}
/* 3 */
{
"_id" : ObjectId("58f58f9c739e558ced008e47"),
"Inventory for NTA SAM Cards" : "02",
"Item Description" : "EZ-Link SAM (Test)",
"Opening QTY" : "220",
"Issued QTY" : "184",
"Corrupted QTY" : "0",
"Closing QTY" : "36",
"Remarks" : "updated 7/11/16"
}
/* 4 */
{
"_id" : ObjectId("58f58fcd739e558ced008e4d"),
"Inventory for NTA SAM Cards" : "03",
"Item Description" : "EZL Production SAM",
"Opening QTY" : "998",
"Issued QTY" : "996",
"Corrupted QTY" : "0",
"Closing QTY" : "2",
"Remarks" : "updated 11/11/2016 150 moved to 18.Auresys Prod"
}
/* 5 */
{
"_id" : ObjectId("58f59034739e558ced008e57"),
"Inventory for NTA SAM Cards" : "04",
"Item Description" : "Payment Link SAM",
"Opening QTY" : "500",
"Issued QTY" : "500",
"Corrupted QTY" : "0",
"Closing QTY" : "0",
"Remarks" : ""
}
/* 6 */
{
"_id" : ObjectId("58f5a1b2739e558ced008f2e"),
"Inventory for NTA SAM Cards" : "05",
"Item Description" : "MEA Production SAM",
"Opening QTY" : "434",
"Issued QTY" : "393",
"Corrupted QTY" : "0",
"Closing QTY" : "41",
"Remarks" : ""
}
Does anyone know whats the problem? 有人知道出什么问题吗? My query is 我的查询是
db.documents.find({"Inventory for NTA SAM Cards":"01"})
I kept getting this 我一直得到这个
Fetched 0 record(s) in 2ms
My collection is called documents. 我的收藏被称为文件。
Try this query 试试这个查询
db.documents.find( { Inventory for NTA SAM Cards: { $eq: "01" } } )
for reference fallow this link 供参考链接
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.