【发布时间】:2018-07-12 19:12:13
【问题描述】:
所以我的 mongodb 中有以下数据:
{
"_id": {
"$oid": "5b479eca54159200044ca729"
},
"name": "note1",
"content": 118
}
{
"_id": {
"$oid": "5b479eca54159200044ca729"
},
"name": "note2",
"content": 122
}
{
"_id": {
"$oid": "5b479eca54159200044ca729"
},
"name": "note3",
"content": 920
}
例如,我如何获取 note3 的内容?或者如果用户想要获取 note2 内容?
所以,为了更好地解释它:
如果我输入控制台 note2,我应该得到 122,如果我输入 note3,我应该得到 920 作为输出。
【问题讨论】:
-
只需要澄清一下,你是用python api还是mongo shell来查询的?
-
我用的是pymongo所以是python api
-
好的,很酷。我将在下面发布答案。让我知道它是否有效。