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: $in with an ObjectId array

Just a quick question about something I've just experienced and I'm still thinking about why: mongos> db.tickets.count({ "…

mongodb mongodb-query mongodb-java morphia
MongoDB: How to get the last updated timestamp of the last updated document in a collection

Is there a simple OR elegant method (or query that I can write) to retrieve the last updated timestamp (of …

mongodb mongodb-query mongodb-oplog
How do I abort a running query in the MongoDB shell?

I can't believe I have to ask this, but how do I stop a query I just ran, which is …

mongodb mongodb-query
Does MongoDB's $in clause guarantee order

When using MongoDB's $in clause, does the order of the returned documents always correspond to the order of the array …

mongodb mongoose mapreduce mongodb-query aggregation-framework
Mongo find duplicates for entries for two or more fields

I have documents like this: { "_id" : ObjectId("557eaf444ba222d545c3dffc"), "foreing" : ObjectId("538726124ba2222c0c0248ae"), "value" : "test", } …

mongodb mongodb-query aggregation-framework
Get first element in array and return using Aggregate?

How can I get and return the first element in an array using a Mongo aggregation? I tried using this …

mongodb mongodb-query aggregation-framework
MongoDB unwind multiple arrays

In mongodb there are documents in the following structure: { "_id" : ObjectId("52d017d4b60fb046cdaf4851"), "dates" : [ 1399518702000, 1399126333000, 1399209192000, 1399027545000 ], "dress_number" : "4", "name" : "…

arrays mongodb mongodb-query bson
Obtaining $group result with group count

Assuming I have a collection called "posts" (in reality it is a more complex collection, posts is too simple) with …

mongodb mongodb-query aggregation-framework
How to query date range on the MongoDB collection where the ISO date is stored in string field?

Scenario: Consider I am having a collection called MyCollection, with following data: { "_id" : 'MyUniqueID_01' "CreatedTime" : "2013-12-01T14:35:00Z", "…

json mongodb mongodb-query bson node-mongodb-native
Why does upsert a record using update_one raise ValueError?

I want to add a record to the collection if the key doesn't already exist. I understand [MongoDB][1] offers the …

python mongodb mongodb-query pymongo