Here's how my document looks:
nookstore = {
"name": "Nook store",
"categories": ["bookstore"],
"working_hours": [
{"opens": 8*60*60, "closes": 21*60*60 },
{"opens": 8*60*60, "closes": 21*60*60 },
{"opens": 8*60*60, "closes": 21*60*60 },
{"opens": 8*60*60, "closes": 21*60*60 },
{"opens": 8*60*60, "closes": 21*60*60 },
{"opens": 8*60*60, "closes": 21*60*60 },
{"opens": 9*60*60, "closes": 20*60*60 },
]
}
...
kindlestore = {
"name": "Kindle store",
"categories": ["bookstore"],
"working_hours": [
{"opens": 0, "closes": 24*60*60 },
{"opens": 0, "closes": 24*60*60 },
{"opens": 0, "closes": 24*60*60 },
{"opens": 0, "closes": 24*60*60 },
{"opens": 0, "closes": 24*60*60 },
{"opens": 0, "closes": 24*60*60 },
{"opens": 0, "closes": 24*60*60 },
],
}
I'm looking for the 24-hours stores, i.e. the stores in which every element of working_hours
opens at 0
and closes at 24*60*60
(seconds after midnight).
I tried using $all
and $elemMatch
, but they work in cases where I need to match if at least one of the elements of an array matches a given criteria (which I don't need).