MongoDB version 3.0.6
So I have this query where I want to perform some less than and greater than operations. Additionally, I want perform an or
operation, but I can't figure out the syntax for that in java. Below is what I have so far:
FindIterable<Document> iterable3 = db.getCollection(collectionName).find(
new Document()
.append("timestamp", new Document()
.append("$gte", startTime)
.append("$lte", endTime))
.append("hourOfDay", new Document()
.append("$gte", minHourOfDay)
.append("$lte", maxHourOfDay))
.append("dayOfWeek", new Document()
.append("$or", new Document("2","4")))
);
What I want is the query to also check if the dayOfWeek
parameter is either equal to 2
or 4
.