I am new to Nodejs and MongoDB. In one of my tasks, I have a dynamic array of phone numbers like this:
var INPUT_ARRAY = [ "1000000000", "1000000050", "1000000100", "1000000101" ];
this array will contains 2k-3k values. I also have a collection employees with employee details around 100000 documents like given below:
{
"_id": {
"$oid": "60536cc1aafebb0d10399df8"
},
"phone": "1000000000",
"first_name": "john",
"last_name": "doe"
}
I need to match dynamic array values against employee collections and need to return all the phone numbers from dynamic array that don't exists in employees collection.
I searched a lot for this and also checked following questions Compare arrays and Return the Difference MongoDB Find values passed in that don't match
but these question's answer didn't worked for me.
Can somebody please help me to find a performance wise better solution?
Thanks in Advance.