skip to Main Content

Update nested array mongodb

I want do an updateMany() operation on a nested array for all documents of my collection. Here is the documents format : { "number": 1, "products": [{ "name": "test", "compositions": ["water", "sugar"], }] }, { "number": 2, "products": [{ "name":…

VIEW QUESTION

Mongodb – How to filter data in collection containing documents with 3 level nested arrays depending on the values in the first and last nested array mongo

I appreciate any help in such case. Collection in MongoDB (now only 4 documents for demonstration purpose): { "_id" : ObjectId("62684847e9594c65cbaa5d85"), "agentId" : NumberInt(1), "agentName" : "Yardi Gaondi", "policyList" : [ { "receivedDate" : ISODate("2022-03-23T04:46:15.000+0000"), "policyStatusDetail" : [ { "policyStsCode"…

VIEW QUESTION

Is there any substitute of $arrayToObject in MongoDb

I have a requirment of inverting an object keys & values. I have following type of data: [ "elements": { "title": "elem_1_6_title", "sub_title": "elem_1_6_sub_title", "media": "elem_1_6_media", "button": "elem_1_6_button", "give_us_call": "elem_1_6_give_us_call" }, "elements": { "title": "elem_1_6_title", "sub_title": "elem_1_6_sub_title" }, "elements": {}…

VIEW QUESTION
Back To Top
Search