I want to combine these two queries into one. I tried with $search: { compound: ...
but not working. I use mongo-atlas.
This query for finding opening dates in particular weekday
const cursor = collections.Restaurants!.find({
$and: [
{ 'timeSlot.1.opening': { $lte: new Date("2022-01-01T08:40:00.000Z") } },
{ 'timeSlot.1.closing': { $gte: new Date("2022-01-01T10:30:00.000Z") } },
],
});
This is autocomplete
query
const agg = [
{
$search: {
autocomplete: {
query: _req.params['title'], path: "title",
fuzzy: {
maxEdits: 1
}
}
},
},
{ $limit: 10 },
{ $project: { _id: 0, title: 1 } }
];
const resturants = collections.Restaurants!.aggregate(agg)
And I just want to is Realm
better than Atlas
for large scale quieries?