Answer the question
In order to leave comments, you need to log in
How to compare MongoDB ObjectIDs?
I have an array of products:
Each product has an _id, I also have a menu object that stores the id of the products:
I tried this way:
products.map(
(product) =>
product._id.toString() ===
menu.products.map((menuProduct) => menuProduct.toString())
)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question