mongodb-stitch

MongoDB Stitch - How to keep datatype to int (without changing to double) when incremented with update?

微笑、不失礼 提交于 2021-02-11 17:51:28
问题 I am using stitch in mongodb. In stitch, i write one nodejs function for increment and decrements purpose. if(changeEvent.fullDocument.type == 'article' || changeEvent.fullDocument.type == 'poll' ) { context.functions.execute("notifyTopic", "article-created", changeEvent.fullDocument); var communities = context.services.get("mongodb-atlas").db("utilo").collection("communities"); communities.updateOne( {_id:changeEvent.fullDocument.community}, {$inc: {"summary.postCount":NumberInt(1)},

MongoDB Stitch - How to keep datatype to int (without changing to double) when incremented with update?

▼魔方 西西 提交于 2021-02-11 17:51:17
问题 I am using stitch in mongodb. In stitch, i write one nodejs function for increment and decrements purpose. if(changeEvent.fullDocument.type == 'article' || changeEvent.fullDocument.type == 'poll' ) { context.functions.execute("notifyTopic", "article-created", changeEvent.fullDocument); var communities = context.services.get("mongodb-atlas").db("utilo").collection("communities"); communities.updateOne( {_id:changeEvent.fullDocument.community}, {$inc: {"summary.postCount":NumberInt(1)},

Push inside forEach with query not working properly

ぐ巨炮叔叔 提交于 2021-02-05 11:37:44
问题 I'm working with mongodb stitch/realm and I'm trying to modify objects inside an array with a foreach and also pushing ids into a new array. For each object that i'm modifying, I'm also doing a query first, after the document is found I start modifying the object and then pushing the id into another array so I can use both arrays later. The code is something like this: exports = function(orgLoc_id, data){ var HttpStatus = require('http-status-codes'); // Access DB const db_name = context

MongoDB Stitch returns data as $NumberDouble instead of the number itself

做~自己de王妃 提交于 2021-01-28 05:39:13
问题 I'm using MongoDB Stitch to create a data enabled API, but when I make a GET request, the data is returned where numbers are displayed as: "firstHit": { "$numberInt": "3" Where I would like them to be return just as: "firstHit": 3 I have a lot of objects within objects, and I am inserting the data through the mongo shell, I'm not sure of that is of any importance. Anyone have any experience with this? Thank you! 回答1: By default, the result format returned by MongoDB Stitch webhooks is in

Suppress value types in MongoDB Stitch function

雨燕双飞 提交于 2020-12-15 17:44:40
问题 A Stitch function returns value types for each non-string field. I believe this is because functions return data in MongoDB Extended JSON. The Mongo Shell, on the other hand, returns standard JSON, and no value types. How do I suppress value types returned by a MongoDB function ? Is it possible to convert EJSON back to JSON? For a date field, for example, the Mongo Shell returns: "dob" : ISODate("1995-01-11T00:00:00.000-07:00") The same query in a Stitch function returns: "dob": { "$date": {

Suppress value types in MongoDB Stitch function

淺唱寂寞╮ 提交于 2020-12-15 17:44:21
问题 A Stitch function returns value types for each non-string field. I believe this is because functions return data in MongoDB Extended JSON. The Mongo Shell, on the other hand, returns standard JSON, and no value types. How do I suppress value types returned by a MongoDB function ? Is it possible to convert EJSON back to JSON? For a date field, for example, the Mongo Shell returns: "dob" : ISODate("1995-01-11T00:00:00.000-07:00") The same query in a Stitch function returns: "dob": { "$date": {

Suppress value types in MongoDB Stitch function

吃可爱长大的小学妹 提交于 2020-12-15 17:40:29
问题 A Stitch function returns value types for each non-string field. I believe this is because functions return data in MongoDB Extended JSON. The Mongo Shell, on the other hand, returns standard JSON, and no value types. How do I suppress value types returned by a MongoDB function ? Is it possible to convert EJSON back to JSON? For a date field, for example, the Mongo Shell returns: "dob" : ISODate("1995-01-11T00:00:00.000-07:00") The same query in a Stitch function returns: "dob": { "$date": {

Suppress value types in MongoDB Stitch function

守給你的承諾、 提交于 2020-12-15 17:38:09
问题 A Stitch function returns value types for each non-string field. I believe this is because functions return data in MongoDB Extended JSON. The Mongo Shell, on the other hand, returns standard JSON, and no value types. How do I suppress value types returned by a MongoDB function ? Is it possible to convert EJSON back to JSON? For a date field, for example, the Mongo Shell returns: "dob" : ISODate("1995-01-11T00:00:00.000-07:00") The same query in a Stitch function returns: "dob": { "$date": {

Suppress value types in MongoDB Stitch function

倖福魔咒の 提交于 2020-12-15 17:35:57
问题 A Stitch function returns value types for each non-string field. I believe this is because functions return data in MongoDB Extended JSON. The Mongo Shell, on the other hand, returns standard JSON, and no value types. How do I suppress value types returned by a MongoDB function ? Is it possible to convert EJSON back to JSON? For a date field, for example, the Mongo Shell returns: "dob" : ISODate("1995-01-11T00:00:00.000-07:00") The same query in a Stitch function returns: "dob": { "$date": {