Page History
...
JSON returns subdocuments and arrays in JSON format.
Example
Code Block |
---|
SELECT JSON *
FROM zips
WHERE city LIKE 'H%' |
FLATTEN_ARRAY
FLATTEN_ARRAY flattens subdocuments and unfurls array values. Each subfield in a subdocument is returned as a separate field. Each value in an array is returned in a separate record with any non-array fields being duplicated.
Example
Code Block |
---|
SELECT FLATTEN_ARRAY *
FROM zips
WHERE city LIKE 'H%' |
DISTINCT | ALL option
...
The DISTINCT keyword returns only distinct (different) values. DISTINCT only supports querying one field based on MongoDB's specifications.
Example
Code Block |
---|
SELECT DISTINCT state
FROM zips |
Info |
---|
MongoDB flattens an array field when processing the DISTINCT command. |
Info |
---|
The following DISTINCT select statements are not supported. They will generate an error. |
ALL
ALL is default. Returns all values.
...