Top "Mongodb-query" questions

This tag is for questions related to querying and updating MongoDB collections, either through the mongo shell or using a programming language driver.

Group result by 15 minutes time interval in MongoDb

I have a "status" collection like this strcture - { _id: ObjectId("545a0b63b03dbcd1238b4567"), status: 1004, comment: "Rem dolor …

mongodb mongodb-query aggregation-framework
Check if every element in array matches condition

I have a collection of documents: date: Date users: [ { user: 1, group: 1 } { user: 5, group: 2 } ] date: Date users: [ { user: 1, group: 1 } { user: 3, group: 2 } ] …

mongodb mapreduce mongodb-query aggregation-framework
Bulk upsert in MongoDB using mongoose

Is there any option to perform bulk upserts with mongoose? So basically having an array and insert each element if …

javascript node.js mongodb mongoose mongodb-query
MongoDB Compass filter (query)

In mongoDB compass I am getting no result with the below filters. Not sure what I am doing wrong. {user: {…

mongodb mongodb-query mongodb-compass
MongoDB: Update/Upsert vs Insert

Recently I notice a huge performance difference between doing multiple upserts (via bulk operations) vs an insert (multiple documents). I …

mongodb mongodb-query upsert
MongoDB concatenate strings from two fields into a third field

How do I concatenate values from two string fields and put it into a third one? I've tried this: db.…

mongodb mongodb-query aggregation-framework string-concatenation mongodb-update
Spring Data mongo case insensitive like query

I want to make a text search case insensitive with regex query with spring-data mongo . For example in Oracle : select * …

full-text-search mongodb-query spring-data-mongodb
MongoDB wildcard in the key of a query

Is it possible to wildcard the key in a query? For instance, given the following record, I'd like to do …

mongodb mongodb-query wildcard
MongoDB: How to find a document by an id inside a nested document

Given a collection like this:.. [ { "_id" : ObjectId("5546329a470000850084a621"), "name": "Joe", "surname": "Smith", "accounts": [ { "_id" : ObjectId("5546329a470000850084a655"), "default": true, "…

mongodb mongodb-query embedded-documents
mongodb query by sub-field

How to query all {"module" : "B"} ? The following query doesn't work: db.XXX.find({ "_id" : { "module" : "B" } }); Thanks a ton! …

mongodb mongodb-query