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.

MongoDB aggregate within daily grouping

I have some docs in mongo that looks something like this: { _id : ObjectId("..."), "make" : "Nissan", .. }, { _id : ObjectId("..."), "make" : "Nissan", "saleDate" : …

mongodb mongodb-query aggregation-framework
Querying MongoDB to match in the first item in an array

I'm aware of the $in operator, which appears to search for an item's presence in array, but I only want …

arrays mongodb mongodb-query
MongoDB Full and Partial Text Search

Env: MongoDB (3.2.0) with mongos Collection: users Text Index creation: BasicDBObject keys = new BasicDBObject(); keys.put("name","text"); BasicDBObject options = new …

mongodb mongodb-query aggregation-framework spring-data-mongodb full-text-indexing
How to exclude one particular field from a collection in Mongoose?

I have a NodeJS application with Mongoose ODM(Mongoose 3.3.1). I want to retrieve all fields except 1 from my collection.For …

javascript mongodb mongoose mongodb-query
How can I sort a Meteor collection by time of insertion?

I am working on my first project using Meteor, and am having some difficulty with sorting. I have a form …

mongodb meteor mongodb-query
How to stop insertion of Duplicate documents in a mongodb collection

Let us have a MongoDB collection which has three docs.. db.collection.find() { _id:'...', user: 'A', title: 'Physics', …

mongodb mongodb-query database nosql
Mongodb - bad query: BadValue unknown top level operator: $gte

What is wrong with this query? I tried to run it on mongodb server and received an error as following …

javascript mongodb mongodb-query aggregation-framework
MongoDB group by array inner-elements

I've got a list of articles, and each of them has an array property which lists various individuals mentioned in …

mongodb mongodb-query aggregation-framework
Mongoose: how to use aggregate and find together

How can I use aggregate and find together in Mongoose? i.e I have the following schema: const schema = new …

node.js mongodb mongoose mongodb-query aggregation-framework
How to get mongo command results in to a flat file

How do I export the results of a MongoDB command to a flat file For example, If I am to …

mongodb mongodb-java mongodb-query