I am having trouble coming up with a good performing mongodb model. I have 2 million employees. I need to store an array of supervisor ids, that can access an employee. Picture data like this..
{
'fullName':'Jonathan Smith',
'employeeId':'8675309',
'supervisors':[1234,7654,45676,34543,56545]
}
Each array could have hundreds of elements. The elements can also fluctuate. So I will need to perform quick $puts and $pulls to add and subtract elements from the array.
I good example operation would be..we have a supervisor 5555 that now has access to 510,000 employees. So I need to update those 510,000 employees, adding 5555 to those employees arrays.
A query would then be, give me all of the employees supervisor 5555 has access to.
is there a better way to do this? Are there things I can do to insure performance.