I have a collection with this fixed structure:
By fixed structure I mean I just push Objects to the level arrays which are starter
- intermediate
and advanced
as you see.
Now suppose you want to fetch intermediate
array only, I can do it like this and it works fine:
const level = 'intermediate';
const motherModel = await db.Mother.findOne({});
const motherLevel = motherModel.cards[level]; // here we can get the specified level
This approach I need to retrieve all the data from database and save it to memory which may not be the best practice nor the fastest way because we only want to get the intermediate
level right?
Is there any better ways to do this? or I'm totally wrong and I can be fine with this approach?