Answer the question
In order to leave comments, you need to log in
How to create such a filter for MongoDB, PHP?
You need to make the following query in MongoDB using PHP:
There is a database. The database has a collection. The collection contains documents. The documents have an array. You need to select this document if there is a certain value in the array. NOT ONLY THIS value, but others are allowed.
I did this:
But in this scenario, MongoDB selects a document if it contains ONLY the value I specified.
That is, with an array of type [$id, $id2, $id3] the document will not be selected $filter = array('admins' => array($id));
Answer the question
In order to leave comments, you need to log in
probably, you have an extra second array.
if the monge does not specify an array for a filter by a field with an array, but simply a value, it searches for it by occurrence.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question