Mongo查询文档的嵌套实体

时间:2018-11-14 09:59:45

标签: mongodb

我有一个下面的实体模式的集合:

{
    "_id": 1,
    "type": "Animals",
    "i18n": {
        "en": {
            "topic": "The dingo is a type of feral dog native to which country?",
            "puzzle": "Africa",
            "answer": "Australia"
        },
        "zh": {
            "topic": "dingo原居住在哪?",
            "puzzle": "非洲",
            "answer": "澳大利亚"
        },// and other languages
    }
}

我想像db.questions.find({'i18n.*.topic':'keyword'})一样按每种语言的主题字段查询所有文档。 mongo是否支持这种查询?

0 个答案:

没有答案