如何在java查询mongo集合中解决此查询

时间:2017-08-10 03:52:09

标签: java mongodb

mongo数据示例:mongo data example :

    Document query1 = doc("project", "projectId")
            .append("student", "studentId")
            .append("target", new Document().append("id","001").append("name","subject"));

    Document query2 = doc("project", "projectId")
            .append("student", "studentId")
            .append("target", new Document().append("name","subject").append("id","001"));

    db.getCollection("collection").find(query1)  //result is not null
    db.getCollection("collection").find(query2)  //result is null

为什么?

0 个答案:

没有答案