I would like to have an object("ingredients" in example) in my mongoose model, where the keys are ObjectIDs, and their values are numbers. Is it possible to do so? How should I define my mongoose schema? You can find an example below.
Example JSON:
{
"_id": ""5a2539b41c574006c46f1a07",
"name": "xyz",
"ingredients": {
"5a23f5e6159f5c3438c75971": 50,
"5a23f60b159f5c3438c75972": 50,
"5a255b04c9d9c40ac8927dd5": 50
}
}
Thank you for your help in advance.