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.

Get a count of total documents with MongoDB when using limit

I am interested in optimizing a "pagination" solution I'm working on with MongoDB. My problem is straight forward. I usually …

mongodb pagination mongodb-query aggregation-framework casbah
Aggregation filter after $lookup

How can I add a filter after an $lookup or is there any other method to do this? My data …

javascript mongodb mongodb-query aggregation-framework
Conditional grouping with $exists inside $cond

I have two keys A and B and their existence in the document is mutually exclusive. I have to group …

mongodb mongodb-query
Select Group by count and distinct count in same mongodb query

I am trying to do something like select campaign_id,campaign_name,count(subscriber_id),count(distinct subscriber_id) group …

mongodb mongodb-query aggregation-framework
Find in Double Nested Array MongoDB

I have this Collection in mongodb { "_id" : "777", "someKey" : "someValue", "someArray" : [ { "name" : "name1", "someNestedArray" : [ { "name" : "value" }, { "name" : "delete me" } ] } ] } I want …

mongodb mongodb-query aggregation-framework
How can I build an $or query for MongoDB using the Java driver?

I'm trying to Or some conditions in MongoDB (using the Java driver). This is what I'm doing : Pattern regex = Pattern.…

java mongodb mongodb-query mongo-java-driver
MongoDB nested lookup with 3 levels

I need to retrieve the entire single object hierarchy from the database as a JSON. Actually the proposal about any …

mongodb mongodb-query aggregation-framework lookup
How to check if a pymongo cursor has query results

I need to check if a find statement returns a non-empty query. What I was doing was the following: query = …

python mongodb pymongo mongodb-query
How to perform a bulk update of documents in MongoDB with Java?

I'm using MongoDB 3.2 and MongoDB Java Driver 3.2. I have an array of a couple of hundreds of updated documents which …

java mongodb mongodb-query crud bulkinsert
The field "$name" must be an accumulator object

I have a query and when I use a $group a error shows "the field "$name must be an accumulator …

mongodb mongoose mongodb-query aggregation-framework