Open brandonLi8 opened 3 years ago
We currently query the usernames to check for uniqueness, and the concern is that this is costly. Using mongo index for usernames in group model would make this really fast, and it looks super simple to set up.
See https://docs.mongodb.com/manual/indexes. For groups, we can use https://docs.mongodb.com/manual/core/index-multikey/ for indexes on arrays. Use the unique option: https://docs.mongodb.com/drivers/node/fundamentals/indexes/#unique-indexes
We currently query the usernames to check for uniqueness, and the concern is that this is costly. Using mongo index for usernames in group model would make this really fast, and it looks super simple to set up.
See https://docs.mongodb.com/manual/indexes. For groups, we can use https://docs.mongodb.com/manual/core/index-multikey/ for indexes on arrays. Use the unique option: https://docs.mongodb.com/drivers/node/fundamentals/indexes/#unique-indexes