-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
db or cache? #51
Comments
Unfortunately there is not. It would be possible to include an extra property in some scenarios, but for example, if you're caching the count, all you get back is a number, so there's no way to add any extra info to that number to denote if it was from the cache or not.
If your two queries have different match criteria, they should generate different cache keys. Can you include the code for your two queries here? |
Hi Bob, Below is what my query looks like. I've removed teh cache line. mongoReply = await item.aggregate([
{
$match: matchQuery
},
{
$project: {
_id: {$toString: '$_id'},
attributes: {
$filter: {
input: '$attributes',
as: 'attribute',
cond: {
$or : condArray
}
}
}
}
},
{
$project: {
'attributes._id': 0
}
}
]); The condArray is an array of objects that look something like this: If we do get this working somehow, won't i need to invalidate the whole cache when i add or delete items? thanks, |
Is there a way for us to know if it retrieved the data from the database or from the cache?
This would be useful to know.
Also, i have some queries that use aggregate. I notice that if i specify different match criteria (for example query 1 is looking for name: bob and query 2 is looking for name: jim), I get the same results as the first query because they had the same cachekey. How can we get around this? I could make a long cachekey that contains all the attributes of the query, but that's not ideal. And then am i to invalidate the whole cache everytime a new item is added or removed?
Any insights would be appreciated.
Thanks,
Jas
The text was updated successfully, but these errors were encountered: