Tag: aggregation-framework

54 votes
22 answers
937 views
Get names of all keys in the collection

I'd like to get the names of all the keys in a MongoDB collection. For example, from this: db.things.in

avatar
Joseph
0 1 0 9
asked 07 September, 2021
59 votes
14 answers
2.5K views
Retrieve only the queried element in an object array in MongoDB collection

Suppose you have the following documents in my collection: { "_id":ObjectId("562e7c594c12942f08fe4192"),

avatar
Clarice
0 1 0 9
asked 07 September, 2021
59 votes
11 answers
2K views
Update MongoDB field using value of another field

In MongoDB, is it possible to update the value of a field using the value from another field? The equivalent

avatar
Carmelina
0 1 0 9
asked 07 September, 2021