I have an array of objects with these fields :
let obj1 : {field1 : value1, field2 : value2, field3 : value3};
let listOfObjects : [obj1 , obj2 , obj3 , obj4 .... objn]
obj1 till objn have the same structure and fields.
I want to query a Model with mongoose, to find docs that has equal value to "field1" in that list of objects "listOfObjects".
I have tried this and it worked, but looking for a better solution if it is possible.
let valuesList = listOfObjects.map( x => x.field1);
let docs = await Model.find({keyToFind : valuesList});
thanks in advance