mirror of
https://github.com/wader/fq.git
synced 2024-10-04 07:27:08 +03:00
18 lines
371 B
Plaintext
18 lines
371 B
Plaintext
def _bson_torepr:
|
|
def _f:
|
|
if .type == null or .type == "array" then
|
|
( .value.elements
|
|
| map(_f)
|
|
)
|
|
elif .type == "document" then
|
|
( .value.elements
|
|
| map({key: .name, value: _f})
|
|
| from_entries
|
|
)
|
|
elif .type == "boolean" then .value != 0
|
|
else .value | tovalue
|
|
end;
|
|
( {type: "document", value: .}
|
|
| _f
|
|
);
|