Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

mongodb update all items in array

// If array field not in find, use $[]
db.products.updateMany({}, {
  $set:{ "variants.$[]._id": new ObjectId() }
})
 
PREVIOUS NEXT
Tagged: #mongodb #update #items #array
ADD COMMENT
Topic
Name
2+7 =