How to filter data between year and month in mongodb?
I want to filter data by year in MongoDB. If I pass year 2022 then show only 2022 year data and when I pass 2023 show 2023 data only. I am not getting how to filter. I use $gte and…
I want to filter data by year in MongoDB. If I pass year 2022 then show only 2022 year data and when I pass 2023 show 2023 data only. I am not getting how to filter. I use $gte and…
What is the best way to find all the documents where objA is the same as objB (order of keys is not important)? Inspired by another question by @Digvijay, I was looking for a way to compare two objects on…
Does it make any sense at all, since the each value of the prefix will have only one value of any suffix, there is no further sorting that can be done after the prefix?
I have a summary schema with a structure like this { sender: { type: mongoose.Schema.Types.ObjectId, ref: "User", required: true, }, summary: { type: String, }, sent: { type: Date, default: Date.now, }, } ); then a convo schema: NOTE: summary…
It seems that the more compound index I add to my collection it gets better to some point and then beyond that the more indexes the slower it becomes. Is this possible? If so why? EDITED: I am referring to…
In my example project, I have employees under manager. Db schema is like this; { "employees": [ { "name": "Adam", "_id": "5ea36b27d7ae560845afb88e", "bananas": "allowed" }, { "name": "Smith", "_id": "5ea36b27d7ae560845afb88f", "bananas": "not-allowed" }, { "name": "John", "_id": "5ea36b27d7ae560845afb88g", "bananas": "not-allowed"…
I have Mongo DB collection which contains items like below: { "_id" : ObjectId("123123123123123123"), "title" : "Item-001", "tags" : [ "red" ], } { "_id" : ObjectId("234234234234234"), "title" : "Item-002", "tags" : [ "red,yellow" ], } Objective: I want to…
I need to search documents using mongo query. I am working on fetching documents that have a list of objects. I am using Spring Data Mongo. I am trying to get documents using the condition but getting this error. Due…
I've been trying to find a way to limit the number of objects i'm pushing to arrays I'm creating while using "aggregate" on a MongoDB collection. I have a collection of students - each has these relevant keys: class number…
I have this in [ { "date": "2022-12-03T12:16:52.403Z", "configs": [ { "name": "Shubham", "values": [ { "text": "172cm", "type": "Height", }, { "text": "80kg", "type": "Weight", }, { "text": "male", "type": "Gender", }, ], } ] }, {....},{....} ] Want…