diff --git a/docs/jsonapi-spec.md b/docs/jsonapi-spec.md index 8d82f8b997..9c9bf68aec 100644 --- a/docs/jsonapi-spec.md +++ b/docs/jsonapi-spec.md @@ -1419,26 +1419,22 @@ The `$all` operation allows users to check for documents that have an array fiel If provided to a `find()`, return all the documents where the locations field contains the two values – “New York” and “Texas”. It does not matter how many more values the locations field contains. The operation will match if the specified values are present. Similarly, if even one the value is missing, the document will not be matched. So the `$all` operation is useful while retrieving data. -The `$all` is equivalent to an `$and` operation of the specified values. For example, this first statement: +#### $elemMatch operation -```json5 -{ tags: { $all: [ "ssl" , "security" ] } } -``` +TODO: -... is equivalent to: +#### $size operation -```json5 -{ $and: [ { tags: "ssl" }, { tags: "security" } ] } +The `$size` operation allows users to match any array with the number of elements specified by the argument. Example: +```json5 +db.collection.find( { field: { $size: 2 } } ); ``` -#### $elemMatch operation - -TODO: +That expression returns, e.g.: `{ field: [ red, green ] }` and `{ field: [ apple, lime ] }`, but not `{ field: fruit }` or `{ field: [ orange, lemon, grapefruit ] }`. -#### $size operation +If the given field is not an array, there's no match. `$size` should ignore non-arrays. -TODO: ### Projection Clause