How to update deep array

11 views
Skip to first unread message

Santosh Maheswari

unread,
Jul 6, 2016, 12:44:04 PM7/6/16
to mongoose-users


I am using mongoose in nodejs...
I want to update deep array but cant update properly..
schema of this field is below...
case_detail : [{
visit_detail : [{
visit_no : Number,
treatment : { 
report : [{name : String,img :{type : 
String,match : /^http:\/\//i}}]
}
}]
}]

I had applied query with the help of https://jira.mongodb.org/browse/SERVER-831 is shown below...

update(

{"_id" : fields.id,"case_detail._id" : fields.case,"case_detail.visit_detail._id" : fields.visit,"case_detail.visit_detail.treatment.report._id" : req.body.PInv}

,{$set : {"case_detail.$0.visit_detail.$1.treatment.report.$2.img" : req.body.img
}})

But is will not showing error nor giving proper error..
i will require help for this problem...
Hope for positive reply..

Sergey Lyubka

unread,
Jul 6, 2016, 12:47:53 PM7/6/16
to mongoose-users
Wrong list

--
You received this message because you are subscribed to the Google Groups "mongoose-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongoose-user...@googlegroups.com.
To post to this group, send email to mongoos...@googlegroups.com.
Visit this group at https://groups.google.com/group/mongoose-users.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages