Considering I have a users collection contains those documents: { _id: 1, hobbies: ['eat', 'read', 'swim'] }, ...
Considering I have a users collection contains those documents: { _id: 1, hobbies: ['eat', 'read', 'swim'] }, ...
Hi I have array field in my document like here: I want access amount and price field with my $project in aggregate framework please help me trough ...
Here's an example through JS code of what I'm trying to achieve: IGNORE MOST OF WHAT'S ABOVE Just realized how poorly written the old question was ...
Below aggregation always produces _id that looks like this. "_id": { "timestamp": 1675104059, "date": "2023-01-30T18:40:59.000+00:00" }, and I need l ...
I want to use $lookup in the aggregate method. The collection I want to do this is like this. It is an array. It has nested objects in the array. Ple ...
I've got let's say one collection "users": And now I have "updates" collection: All have common User.id field. Now I'm trying to get data from ...
This is the document I get after an aggregation query: { _id: <some id>, name: 'xxxx', sales: { saleDate: 'dddddd', saleValue: 99 ...
I need to match all documents where field arr, which is an array of object Ids, has same elements of a given one no matther the position. I tried: ...
In the group stage I want to create a new array of colors, the colors are objects of two fields (name, value), the resulted array must contain colors ...
In my code i am trying to collect the available filters however there are fields that were not filled by the user and left as empty strings e.g the "b ...
In the $lookup stage of my aggregation pipeline, it needs to join based on _id, which is indexed on the joined collection. The purpose is to simply ch ...
Assumption: All data and indexes are in RAM. First query: Second query: My reasoning: The second query should be faster because the $in ...
Do indexes always persist on RAM? Hence, does scanning indexes require first retrieving the index from disk? EDITED: My questions is more abo ...
In mongo db, I have the input collection Collection name - dirPermission and sample record [ { dirId: "1", dirName: "firstDir", u ...
I have an aggregation pipeline like this in MongoDB: That works, but I wonder if I can reformulate it using pure JSON syntax (note that ISODate() d ...
I have a compound index and an index on a single field A. If in a find query, the compound index was chosen as the winning plan, and the results are s ...
How to create a unique ID for each element of an array field, where uniqueness is maintained globally for all documents of the collection? Is it ...
Array field in collection: I need to find those documents in collections, where "banana" signed before "apple". Does mongodb allows to compare elem ...
Mongo graphLookup problem. I want the num of degrees separation between jerry and superman, the answer should be 2. In my bi-directional node struct ...
In my app, users can block other users. There will be queries where I will need to find At what length of array_that_contains_all_blocked_user_ids ...