I have a collection c in DB named ftest in MongoDB. A document has been created in that collection with a NumberLong field this way:
db.c.insert({x: NumberLong("1")})
I get the content of the collection this way (based in this approach):
$ mongosh mongodb://localhost:27017/ftest --eval 'JSON.stringify(db.c.find().toArray(), null, " ")' --quiet
[
{
"_id": "6580316ed1c208e8c6059954",
"x": {
"low": 1,
"high": 0,
"unsigned": false
}
}
]
Comparing with how mongo legacy shell works:
$ mongo mongodb://localhost:27017/ftest --eval 'JSON.stringify(db.c.find().toArray(), null, " ")' --quiet
[
{
"_id": {
"$oid": "6580316ed1c208e8c6059954"
},
"x": {
"$numberLong": "1"
}
}
]
So:
- What's the meaning of
low,highandunsigned? Are they documented somewhere? - Can they be converted to a single field in a similar way mongo legacy shell does?
Thanks!
Thanks to @WernfriedDomscheit feedback, using
I get
which cover perfectly my use case.