Closed genxlogics closed 7 years ago
I see that release 3.1 has the fix to pass the filter parameters for array. if somebody could please help me if my query below is right??
PATCH /test/11223344?filter={"addresses.addressType":"R"}
{ "$set":{ "addresses.$":{ "addressType" : "R", "line1" : "new line" } } }
This is how my document looks in mongo
{ "_id" : "11223344", "addresses" : [ { "addressType" : "R", "line1" : "address line 1" }, { "addressType" : "P", "line1" : "address line 1" } ], "_etag" : ObjectId("59526502f8b5360a60b6beef") }
tested and worked....issue can be closed.
Hi All, I have a requirement where i need to update an embedded document inside array using filter condition. i see that mongodb provides it this way db.orders.update( { "_id" : 45218468309, "items.sku" : "MO001" }, { "$set" : { "items.$" : { "sku" : "MO001", "description" : "Bluetooth mouse", "quantity" : 2, "unit_price" : 20.00, "price" : 40.00, "vat" : 20.00 } } } );
i would like to do this same using restheart. i have the documentID but how would i find the exact element of array and set it?? please help