I would like to get the following mongo request in Java.
db.getCollection('document').find({ "$and": [ {"storeId":"1234"}, {"tranDate" : {"$gte":new Date("Sat,01 Oct 2016 00:00:00 GMT"), "$lte":new Date("Mon,31 Oct 2016 00:00:00 GMT")}} ] }, {"_id" : 0})
I have the following java code, but I'm not sure how to add suppression logic,
List<Bson> conditions = new ArrayList<>(); conditions.add(eq("field1", "value1")); conditions.add(eq("field2", "value2")); Bson query = and(conditions); FindIterable<Document> resultSet = db.getCollection("document").find(query);
I need to add {"_id": 0} in the code logic to suppress the "_id" field. Please let me know how I can achieve this.
source share