Reputation: 1153
I have a query that looks like this:
listProjectQry = [
{
$match: {
city: city
}
},
{
$project: {
_id: 0,
rating: 1,
title: 1,
amenities: 1
}
}
]
This works fine but the amenities object actually maps to an array of amenity objects that themselves contain multiple fields. Right now I'm getting the entire array of amenities, but I'm wondering if I can make an array of just the IDs of the amenities and send that back down to the clients.
The intent is to make the query more performant and take less time. Maybe this optimization wouldn't help make it faster?
Upvotes: 2
Views: 1460