Skip to content
Advertisement

Tag: mongodb

How to query on collection values ​and referenced documents values ​in MongoDB?

I don’t know how correctly I formulated the question. I need to execute a query on both the values ​​of the collection and the values ​​of the referenced objects. The original collection looks like this: When executing a query that meets the condition district == “Texas”, I need to get the following result: Under this condition: kind == “developer”, get

Match based on a field only with non-empty array

I am trying to do a filter on something. Here is a simplified layout of my Order model: I want to query the documents based on the ingredients that they contain. I have an array of items to search through “objectifiedIngredients”. If it has ingredients in it, then I want to search for orders that contain that ingredient. If the

Push object to array in mongodb nodejs [closed]

Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 2 years ago. Improve this question This is my mongodb collection. I want to push object to array with findOneAndUpdate(). This is my nodejs code. How can i do this? Answer

Advertisement