Linked Questions
150 questions linked to/from How to Update Multiple Array Elements in mongodb
66
votes
3
answers
54k
views
Remove a field from all elements in array in mongodb [duplicate]
I have below document in MongoDB(2.4.5)
{
"_id" : 235399,
"casts" : {
"crew" : [
{
"_id" : 1186343,
"withBase" : true,
"...
27
votes
2
answers
61k
views
Mongodb error: The positional operator did not find the match needed from the query [duplicate]
I have a collection with objects like this
{
"_id" : ObjectId("5742be02289512cf98bf63e3"),
"name" : "test1",
"attributes" : [
{
...
8
votes
4
answers
25k
views
MongoDB update multiple records of array [duplicate]
I recently started using MongoDB and I have a question regarding updating arrays in a document.
I got structure like this:
{
"_id" : ObjectId(),
"post" : "",
"comments" : [
{
"...
3
votes
4
answers
9k
views
Update multiple elements in an array in mongodb [duplicate]
I have a document like following in my stocks collection in mongodb.
{ _id: 'xRMuRBhqRLgASyQyW',
History:
[ { orderId: '12032017001877',
status: 'COMPLETED',
},
{ ...
3
votes
1
answer
10k
views
Update all elements in an array in mongodb [duplicate]
I have an mongodb document like:
{
"name" : "JohnDoe",
"adds" : [
{
"status" : "PENDING",
"date" : "2015-09-23"
},
{
"status" : "...
1
vote
3
answers
5k
views
MongoDB : Add field in each array elements [duplicate]
I'm starting with mongoDB and I want to update a nested array in my documents to add some initial value, but I can't find a way to do it with mong.
here is my document :
{
"_id":"cTZDL7WThChSvsvBT",
...
4
votes
1
answer
5k
views
How yo use arrayFilters with mongoose 5.x.x? [duplicate]
I've asked a question couple of days ago about updating arrays in nested arrays of objects. Right now MongoDB 3.6 officially supports it via arrayFilters feature.
Is it implemented in Mongoose 5.x.x? ...
1
vote
1
answer
3k
views
Mongodb update : add a field to each elements of an array of collections [duplicate]
The title is a little bit hard to understand the first time, so here is an example. I use mongodb and have data like this :
id: String
timestamp: String
steps: [{
action: 1,
timestamp: String
}, {...
1
vote
1
answer
3k
views
Mongoose update array of subdocuments [duplicate]
Can I update all the subdocuments in array matching my update query? Here is example of collection elements:
{
x: 1,
myarray: [
{
a: 1,
b: 2,
},
...
4
votes
1
answer
795
views
How to change all the array elements in a mongodb document to a certain value? [duplicate]
Suppose I have the following document
{
_id: ObjectId("5234cc89687ea597eabee675"),
code: "xyz",
tags: [ "school", "book", "bag", "headphone", "appliance" ],
qty: [
{ size: "S", ...
1
vote
1
answer
2k
views
update multiple elements in array mongodb [duplicate]
I want to update chargeList isDelete property to true when date is greater than a specific value. my schema as follows.
{
"chargeList": [
{
"date": ISODate("2013-06-26T18:57:30.012Z"...
0
votes
1
answer
1k
views
MongoDB UpdateMany Child Array without filter [duplicate]
Mongo Playground
Simple Schema:
[
{
"key": 1,
"Array": [
{
"Prop1": 1,
"Prop2": 2
},
{
"Prop1": 2,
...
0
votes
1
answer
2k
views
Remove array element from ALL documents using MongoDB C# driver [duplicate]
Given the following:
{
"_id" : 1,
"name" : "Nature",
"area": [
{
"place": "Some place",
"discoveredBy": ""
},
{
"place": "Some ...
0
votes
1
answer
1k
views
update nested array element value in node js mongoDB [duplicate]
Hi i am new in nodejs i need to update a value in nested array using _id of document my database document is look like this..
"complaints" : [
{
"complaint" : "head light is not working"...
0
votes
2
answers
607
views
Updating multiple embedded document not working [duplicate]
I have a table with data like
{
_id: ....
Name
...
"RoomStatusDetails": [
{
"StatusEntryId": ObjectId("5bd6ea81d2ccda0a780054da"),
"RoomId": "78163a07-76db-83c1-5c22-0749fab73251",
"...