通过两个属性匹配数组

时间:2015-09-04 15:00:50

标签: java mongodb mongodb-query

我试图查询MongoDB集合,如下所示

delete from 
   emp1
where rowid in
 (select rowid from 
   (select rowid, row_number() over (partition by EmpID, SalID , EmpName order by /*column to order row*/ EmpID) row_no from emp1)
  where row_no > 1);

当我试图用XYZ查询名称并且年龄为19时它的匹配并且给出的结果不应该因为名称与不同的对象和年龄匹配而不同,我该怎么做并查询同一个对象以便我完全匹配完整的对象。下面是它给我结果的java代码,但我希望它不会

  {
            "_id" : ObjectId("55e9a8efc4fd0e172cbffcae"),
            "type" : "b",
            "name" : [
                    {
                            "name" : "XYZ",
                            "age" : "25",
                            "source" : [
                                    {
                                            "source" : "srcOne"
                                    }
                            ]
                    },
                    {
                            "name" : "ABC",
                            "age" : "19",
                            "source" : [
                                    {
                                            "source" : "srcTwo"
                                    }
                            ]
                    }
            ]
    }

0 个答案:

没有答案