What's difference between .in() and all.() operators in mongoose?
mongodb, mongoose
Solution
Here is the explanation from mongodb.org:
$all
The $all operator is similar to $in, but instead of matching any value in the specified array all values in the array must be matched. For example, the object
{ a: [ 1, 2, 3 ] }
would be matched by
db.things.find( { a: { $all: [ 2, 3 ] } } );
but not
db.things.find( { a: { $all: [ 2, 3, 4 ] } } );
An array can have more elements than those specified by the $all criteria. $all specifies a minimum set of elements that must be matched.
Read more about mongodb operators here
Problem
I'm just curious what's difference between .in() and .all() methods in mongoose Query? Can you explain by a simple example.