Looping Through And Filtering The Data In Express And Mongoose
I have a backend with Node.js, Express and Mongoose. I am trying to filter an array of documents that is nested deep in an object but I am not able to access the array for some rea
Solution 1:
There are a few issue with your friendRequests
array.
First you didn't begin or end your object correctly.
friendRequests: [
{ <===========================Needanotherbracket_id:5f71c1184a54b03e70fcbea0,
owner:'5f71c0d14a54b03e70fcbe9b',
friend:false,
name:'mad max'
},
{
_id:5f76a7872b21c8208f3caa5f,
owner:'5f742182931ab9125bc2ec9d',
friend:false,
name:'shriya rai'
},
{
_id:5f76f6fa85e74758e76cb1ec,
owner:'5f76f541ab7a1255dc78987d',
friend:false,
name:'dara singh'
}
]
Second make sure you make those _id into string
5f76f6fa85e74758e76cb1ec to"5f76f6fa85e74758e76cb1ec"
Post a Comment for "Looping Through And Filtering The Data In Express And Mongoose"