Я хочу, чтобы выбрать только «ЬЬеТехЬ» поле на определенном индексе, например, когда "comment_count"= 1
Выберите конкретное поле индекса в MongoDB
Я попробовал этот запрос:
db.getCollection('mongotesi').find({},{'bug.long_desc.1.thetext':'1'})
Я хочу показать все поля «thetext» тоже. Это структура JSON:
{
"_id" : ObjectId("5613c8acc8e53ab811000083"),
"@attributes" : {
"version" : "4.4.10",
"urlbase" : "https://bugs.documentfoundation.org/",
"maintainer" : "[email protected]"
},
"bug" : {
"bug_id" : "31585",
"creation_ts" : "2010-11-12 08:55:00 +0000",
"long_desc" : [
{
"@attributes" : {
"isprivate" : "0"
},
"commentid" : "194230",
"comment_count" : "0",
"attachid" : "40242",
"who" : "eric.moret",
"bug_when" : "2010-11-12 08:55:52 +0000",
"thetext" : "Created attachment 40242ooo base fileI am running ooo 3.2.1 OOO320m18 (Build:9502). I am using an odb bas file to perform a mail merge on an odt file under writer. In the mail merge Wizard, on hitting Next in step 6. (Edit Document), the Status window - creating document opens up and generates my mailing. The crash happens reliably while performing this task. I have 118 items to generate.My error report id is: rpmrd6nAttached are the 2 files used for this merge."
},
{
"@attributes" : {
"isprivate" : "0"
},
"commentid" : "194232",
"comment_count" : "1",
"attachid" : "40243",
"who" : "eric.moret",
"bug_when" : "2010-11-12 08:56:29 +0000",
"thetext" : "Created attachment 40243ooo write file"
},
],
}
}
я спросил что-то очень похоже вчера и ответ нет, Монго не поддерживает это пока. Я могу получить вам ссылки и инструменты, если хотите. –
вот мой вопрос: http://stackoverflow.com/questions/32976362/does-mongodb-have-a-path-wildcard?noredirect1_comment53778683_32976362 Я использую модуль узла "tree-math" для среза и кубирования когда он выходит. Отказ от ответственности: я написал древовидную математику. Продвижение: древовидная математика. –
не возвращает точное значение ключа, но возвращает конкретный массив позиций, используя [slice] (http://docs.mongodb.org/manual/reference/operator/projection/slice/) – Yogesh