Category "aggregation-framework"

MongoDB Duplicate Documents even after adding unique key

I have created a collection and added a unique key like this db.user_services.createIndex({"uid":1 , "sid": 1},{unique:true,dropDups: true}) The collection

Calculate the median in MongoDB aggregation framework

Is there a way to calculate the median using the MongoDB aggregation framework?

group in mongo excluding null values

I have mongo query which does the group operation on the documents. I have almost got the expected results except that I want to refine the results without emp

Performance penalty when using fluent interface

I am an absolute beginner when it comes to MongoDb. Just joined a new project where it is used, so I tried to do few experiments to get myself familiar. I got t

Specify raw aggregate request with Spring Data Mongodb

I write a big aggregate query for mongodb, now I try to translate it in Spring Data Mongodb API, and it's very complicated, and spring data api did not help me

Find duplicate records in MongoDB

How would I find duplicate fields in a mongo collection. I'd like to check if any of the "name" fields are duplicates. { "name" : "ksqn291", "__v" : 0

How to match multiple array elements without using unwind?

I have a collection which contains documents with multiple arrays. These are generally quite large, but for purposes of explaining you can consider the followin

MongoDB Merge Equivalent Collections

I have two collections with same structure and want to merge them in aggregation result and query & sort over them after merging. E.g.; First collection: