'Can I omit the $and in the $match stage in Mongo's aggregate?
In $match, is there a difference in behaviour between the following with and without $and?
db.emails.aggregate([
{
$match : {
$and: [
{receivedAt: { $gte: "2021-01-01"}},
{receivedAt: { $lt: "2022-02-01" }}
]
}
}
])
or
db.emails.aggregate([
{
$match : {
receivedAt: {
$gte: "2021-01-01",
$lt: "2022-02-01"
}
}
}
])
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
