How to find documents matching multiple criteria

后端 未结 3 659
滥情空心
滥情空心 2020-12-16 05:19

I\'m trying to query a collection using operands AND\'d together. I\'ve got the shell version working:

db.widgets.find({color: \'black, shape: \'round\', wei         


        
3条回答
  •  天涯浪人
    2020-12-16 05:52

    BasicDBObject criteria = new BasicDBObject();
    criteria.append("color", "black");
    criteria.append("shape", "round");
    criteria.append("weight", 100);
    
    DBCursor cur = widgets.find(criteria);
    

提交回复
热议问题