-3
db.getSiblingDB("pilates").ball.find({ "list.Barcode.": "80196061999242"})
このクエリを実行すると、このドキュメントが表示されます。見つかった項目を配列として変数に代入する
{
"Brand" : "Givi",
"list" : [
{
"Barcode" : [
"8019606199942"
]
}
..
}
]
.
...
.
}
しかし、私はこの
db.getSiblingDB("pilates").ball.find({ "list.Barcode.": "80196061999242"}) .forEach(function(x){
print("m "+x.list.[0].Barcode);})
を実行したときに、それがこの
を与え、この出力にm undefined
またはこの
print("m "+x.list.(0).Barcode);})
のためを提供します
この
与える)};このprint("m "+x.list.Barcode);})
ため
is not a function :
@(shell):4:16
[email protected]/mongo/shell/query.js:501:1
@(shell):1:1
この プリント(。。 "M" + X $バーコード)については、この
m undefined
を与えます
$ is undefined :
@(shell):4:3
[email protected]/mongo/shell/query.js:501:1
@(shell):1:1
なぜcそれは得るか?
質問をよくお寄せください。コードスニペットatmの一部を読むのは苦痛です。また、すべてのコードはJavaScriptのようですが、Javaタグを正しく使用していますか? – Thomas
'list [0]'の必要性とは別に、あなたが '' list.Barcode。 "'とタイプミスしているかどうかは不明です。データは正しく表されません。実際のクエリが実行されている場合。それが実際のクエリであれば、 'x.list [0] ['Barcode。'] [0]'キー名に "dot"を含める –