how to Suppress value data types in MongoDB Stitch http get function

Skip to first unread message

Mahesh Maheswaran

Jun 23, 2019, 7:50:47 AM6/23/19
to MongoDB Stitch Users
Hello Experts,

I have created a http get service to show all data from one collection. But json is returning data type also . Bu I don't want to show data types.

const result =  doc.find({}).toArray();
return result;

Drew DiPalma

Jun 23, 2019, 10:24:53 AM6/23/19
to MongoDB Stitch Users
Hi Mahesh – Values are returned in EJSON by default, in order to return as JSON, you can wrap result in JSON.stringify().  

Mahesh Maheswaran

Jun 24, 2019, 8:30:07 AM6/24/19
to MongoDB Stitch Users
Hello Drew, 

Thanks for your reply. I tried that but when I am wrapping, it is returning as null else it is returning with datatypes.

Jose Luis Campos

Aug 8, 2019, 1:17:59 PM8/8/19
to MongoDB Stitch Users
Hi everybody,

I'm glad to see I'm not the only one trying to load GeoJson to the client directly from Webhook service. that would be great!

I have correctly load to google map API (' writting 'manually' on function editor like this....


exports = function(request, response) {
    var data = {
      "type": "FeatureCollection",
      "features": [ {"type":"Feature",
    response.addHeader("Content-Type", "application/json");


And works perfectly but..... 

If I try to get the features array from the mongodb context, I cannot get correctly stringify the EJSON from the query result....

Any ideas????

Thanks in advance

Jose Luis Campos
Reply all
Reply to author
0 new messages