Skip to main content
0 votes
1 answer
53 views

mongo aggregate `$in` behaves differentyl than the `$in` in a query filter?

i tried to count stuff in group (by a filed location) but with a condition. So i got a group with multiple values: escalated and non-escalated. (and count for testing) The condition is a boolean field ...
A. Rabus's user avatar
  • 529
0 votes
1 answer
43 views

MongoDB Aggregation $text search fails with none existing collection in the error returned in Node.js

I'm encountering a very strange issue after switching a MongoDB aggregation pipeline from using $regex to a more efficient $text search. My application code is correct, but the server returns an error ...
Tsepo Nkalai's user avatar
  • 1,514
-2 votes
1 answer
91 views

In MongoDB, is there a performance difference between $in covering all possible values vs leaving the field out in a compound index?

I’m working with a MongoDB compound index like this: db.users.createIndex({ gender: 1, city: 1, age: 1 }) Suppose city has only a few possible values, e.g., "Chicago", "LA", "...
Bear Bile Farming is Torture's user avatar
-3 votes
1 answer
94 views

query that tries to match everything does not use the index [closed]

https://mongoplayground.net/p/2CHyeuaG0y0 db.test.aggregate([ { $match: { $or: [ { cheese: { "$exists": true } }, { ...
Bear Bile Farming is Torture's user avatar
0 votes
1 answer
82 views

Does MongoDB update an index when array elements are only reordered?

I’m working with a collection where documents contain an array of subdocuments, for example: { "_id": 1, "tasks": [ { "priority": 2, "dueDate": "...
Bear Bile Farming is Torture's user avatar
-1 votes
1 answer
67 views

Can MongoDB use a compound index to sort when filtering with $in?

I have a users collection with a compound index: db.users.createIndex({ bin: 1, gender: 1, age: 1, location: 1, // ... other fields }); When I query like this: db.users.find({ bin: X, ...
Bear Bile Farming is Torture's user avatar
0 votes
1 answer
53 views

Performance impact of updating leading vs. trailing fields in a MongoDB compound index

I am working with MongoDB and have a compound index on a collection, e.g., { a: 1, b: 1 }. I want to understand the performance implications when updating documents with respect to the fields in this ...
Bear Bile Farming is Torture's user avatar
-2 votes
1 answer
80 views

can mongoDB use the full depth of a compound index on an array of subdocuments?

index: { "name": "tar", "key": { "tar.a": 1, "tar.b": 1 } tar is an array of subdocuments. query: ...
Bear Bile Farming is Torture's user avatar
-5 votes
1 answer
73 views

Can MongoDB use an index for $exists: false on an indexed field? [closed]

Given a aggregation pipeline like this, in which I use a $match with { $exists: false } on a indexed field: db.collection.aggregate([ { $match: { myField: { $exists: false } } } ]) ...
Bear Bile Farming is Torture's user avatar
1 vote
1 answer
81 views

Nested grouping with Doctrine ODM MongoDB aggregation framework

Doctrine ODM allows to group a set of matched documents: https://www.doctrine-project.org/projects/doctrine-mongodb-odm/en/2.9/reference/aggregation-stage-reference.html#group Consider documents ...
David's user avatar
  • 2,863
0 votes
1 answer
59 views

Mongo how to group by and count all values which is in list of dicts

How to group by and count value of field which is in list? I have documents looks like this: [ {"_id": "some_id","uuid": "unique_uuid", "my_field": [{&...
Zesshi's user avatar
  • 524
0 votes
0 answers
30 views

Google map matrix limitations in node js

I'm using the Google Maps Distance Matrix API to calculate route-based distances (not straight-line distances). However, since third-party API calls cannot be made within a MongoDB aggregation ...
Zeeshan Abbasi's user avatar
1 vote
0 answers
25 views

Efficient Pagination with $lookup across Two MongoDB Collections with Filters on Both Sides

I have two MongoDB collections: c1 and c2. c1 has properties: p1, p2 c2 has properties: p3, p4 c1._id is referenced by c2.customerId I need to: Perform a $lookup to join c1 with c2 Apply filters on ...
arrxy's user avatar
  • 11
1 vote
2 answers
62 views

How to partition the data twice using MongoDB aggregation pipeline?

I have a sample data that I need to partition using two keys: key and subkey. Based on the grouping, the amount will be summed up. Sample Data: [ { "key": "1", "...
Joseph D.'s user avatar
  • 12.2k
0 votes
1 answer
86 views

MongoDB: rename a field with dot in it

I have a MongoDB collection that contains several fields with dots, like: { "symbol.name": "Some name" "symbol.state": "Some state" // etc. } Now, ...
Nikolay Kovalenko's user avatar

15 30 50 per page
1
2 3 4 5
843