Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

mongodb update all items in array

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