MongoDB. Find documents which contain value from array -


so have array values.

how can find documents contain in specific field value array?

for example:

array : ["1", "2"] 

documents

{field : "1"},  {field : "2"},  {field : "3"} 

i need find:

{field : "1"},  {field : "2"} 

can please try this?

db.inventory.find( { field: { $in: [ "1", "2"] } } ) 

Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -