TypeError: Cannot read property 'userId' of null
uma-08 opened this issue · 1 comments
uma-08 commented
UtkarshA135 commented
your mongoose model query function Users.find() gives you an array of objects So if you want to Access it the way you have used try like this
Users.findOne({userid:xxx},callback);
or you have to access the array index if you use it find() method
Users.find({userId:xxx},(users)=>{users[0]==neededId}