Why my mongodb-stitch service return me the value type ($numberLong, $numberInt,…)?

751 Views Asked by At

Why my mongodb-stitch service return me the type of value ($numberLong, $numberInt,…) while the Compass application do not do ?

How to have the same varialble format like in Compas or how to handle this with Stitch ?

Mongodb-stitch

enter image description here

Compass

enter image description here

1

There are 1 best solutions below

1
On

MongoDB Stitch functions have access to utility packages provided through various global variables.

And some of them are below: https://docs.mongodb.com/stitch/functions/utilities/
JSON
EJSON
BSON

When you execute your function, response prints with EJSON. Thats why you see your response like this at result tab, in the bottom of your response like that:

result (JavaScript): EJSON.parse('[{"_id":{"$oid":"5bf9302f72a975ed8229fdf4"}, "rating": {"$numberDouble": "5"}, {...