How can I search with mongoose to find duplicate values in different fields?
Here is sample document:
{
"followers": {
{
"_id": "5bf6d610d3a3f31a6c75a9f4"
},
{
"_id": "5bf6d610d3a3f31a6c75a8c3"
}
},
"following": {
{
"_id": "5bf6d610d3a3f31a6c75a9f4"
},
{
"_id": "5bf6d610d3a3f31a6c75b7a2"
}
},
}
I want to find same _id values under followers and following fields.
Expected Output:
{
{
"_id": "5bf6d610d3a3f31a6c75a9f4"
}
}
What query should I use?
followersandfollowingwould be the Array. right?