mirror of
https://github.com/wader/fq.git
synced 2024-12-22 04:41:36 +03:00
628f0f403d
Only supports basic types for now
19 lines
390 B
Plaintext
19 lines
390 B
Plaintext
def bson_torepr:
|
|
def _torepr:
|
|
( if .type == null or .type == "array" then
|
|
( .value.elements
|
|
| map(_torepr)
|
|
)
|
|
elif .type == "document" then
|
|
( .value.elements
|
|
| map({key: .name, value: _torepr})
|
|
| from_entries
|
|
)
|
|
elif .type == "boolean" then .value != 0
|
|
else .value
|
|
end
|
|
);
|
|
( {type: "document", value: .}
|
|
| _torepr
|
|
);
|