Instead of:
{
A: [user_id_1, user_id_2, etc.]
}
I want to create this schema:
{
A: {
user_id_1: true,
user_id_2: true,
etc...
}
}
The reason is because in order to find if user_id_x is $in A, if it is an array, the time complexity is O(N).
However, as I understand it, the time complexity to find a key value pair is either O(1) or O(logN).
If I choose the schema design for MongoDB, will it have the performance improvements described abolve?