[SERVER-39599] i am getting Error : MongoError: No array filter found for identifier 'i' in path 'mainCourse.$[i].subCourse.$[j].ppt' Created: 15/Feb/19  Updated: 19/Feb/19  Resolved: 19/Feb/19

Status: Closed
Project: Core Server
Component/s: JavaScript
Affects Version/s: 4.0.4
Fix Version/s: None

Type: Question Priority: Major - P3
Reporter: Malaviya Digant Assignee: Kelsey Schubert
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: PNG File Screen Shot 2019-02-15 at 6.15.17 PM.png    
Participants:

 Description   

var pId=random('Aa0', 6);
db.collection('test').updateOne({ F_id : req.params.F_id },{ $push : { "mainCourse.$[i].subCourse.$[j].ppt" :

{ pageid : pId , pagelink : link+'/ppt/'+fileName }

} } ,{ arrayFilters : [

{ 'i.id' : req.params.MC_id }

, { "j.id" : req.params.SC_id } ]}, (e,r)=>{
if(e)

{ return res.send(\{Error :'Y' , msg :'Here Database Error '+e}

);
}
return res.send({Error :'N' , msg :'PPT Added Successfully'});
});
 
i need to push data in ppt  see in ScreenShot
 
i am getting Error like this :
 
MongoError: No array filter found for identifier 'i' in path 'mainCourse.$[i].subCourse.$[j].ppt'
 
or Any other way to push data in ppt please give suggestion
 



 Comments   
Comment by Kelsey Schubert [ 19/Feb/19 ]

Thanks for the update, m_digant. I'm glad you were able to identify and correct the issue.

Comment by Malaviya Digant [ 16/Feb/19 ]

Issue is solve there is problem in Nodejs Version

if using mongodb version "2.2.34" in nodejs side then use below syntex

mc and sc = which array position u need to store
var qry2= { F_id :req.params.F_id , mainCourse : { $elemMatch : { id :req.params.MC_id , subCourse :{ $elemMatch :

{ id :req.params.SC_id }

} } } }; // for my docment u can see in img
db.collection('test').update(qry2,{ $push : { ["mainCourse."+mc+".subCourse."+sc+".ppt"] :

{ pageid : pId , pagelink : link+'/ppt/'+fileName }

} } , (e,r)=>{
if(e)

{ returnres.send(\{Error :'Y' , msg :'Here Database Error '+e}

);
}
returnres.send({Error :'N' , msg :'PPT Added Sucessfully'});
});

Comment by Malaviya Digant [ 16/Feb/19 ]

Any one here to help me??? i am already waste my 1 day if any one know please give me suggestions.. 

Generated at Thu Feb 08 04:52:32 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.