cloud-code

Parse Cloud Code retrieving a user with objectId

送分小仙女□ 提交于 2019-11-29 04:31:56
I am trying to get the user object from objectId. I know the objectId is valid. But I can get this simple query to work. What is wrong with it? user is still undefined after the query. var getUserObject = function(userId){ Parse.Cloud.useMasterKey(); var user; var userQuery = new Parse.Query(Parse.User); userQuery.equalTo("objectId", userId); userQuery.first({ success: function(userRetrieved){ console.log('UserRetrieved is :' + userRetrieved.get("firstName")); user = userRetrieved; } }); console.log('\nUser is: '+ user+'\n'); return user; }; Quick cloud code example using promises. I've got

Parse JavaScript SDK and Promise Chaining

瘦欲@ 提交于 2019-11-28 10:35:31
I have created a Background Job in Parse Cloud Code that sends out email notifications based on a date in one of my Parse classes. Here is the idea: Query the class that contains the date. Iterate over each object returned and check the date field. If the date is equal to today, send out an email notification, change the date to null and save it back to Parse. However, it seems that not all the objects are saved back to Parse. I suspect this an issue with my promise chains, but I am having a hard time diagnosing the exact issue or how to fix it. Below is relevant code Parse.Cloud.job("job",

In cloud code, call a Parse.Cloud.run function more than once in series

橙三吉。 提交于 2019-11-28 01:44:55
Say you have a "define" Parse.com cloud code function... Parse.Cloud.define("exampleDefineFunction", function(request, response) { ... response.success("ok") ... response.error("doh") }); I want to make another cloud code function, which calls that define function a number of times in series , with one waiting for the next, much as in a serial promise chain Can this be done? Russell I think this should do the trick! In this scenario we want to use Parse.Promise.when() Returns a new promise that is fulfilled when all of the input promises are resolved. If any promise in the list fails, then the

Parse request.object.get(“KEY”) always returns undefined

♀尐吖头ヾ 提交于 2019-11-27 09:29:53
I have a strange problem over here. I have a project built with Parse.com as a backend (using cloudcode to verify some things when a connection to the database is made). Everything works just as it should do. But here comes the problem. Another developer reported to me that there is something wrong because he is getting 'undefined' every time he tries to call request.object.get('KEY') in CloudCode. This developer uses the exact same codebase as I do. So I decided to have a look at it. While with my Parse account, every application works fine (even newly created ones), with the Parse account of

Firebase AfterSave function like Parse.com

不打扰是莪最后的温柔 提交于 2019-11-27 07:19:47
问题 So I was using Parse.com AfterSave cloud code function to keep a list of the most recent Posts relating to a specific location. The reason for this is to get the most recent post for a location without having to search and order the entire list of posts for all locations. This was nicely done in Parse AfterSave because I didnt have to worry about clients exectuing this command, it made sense for it to run in the cloud. Now that parse is shutting down, I've decided to migrate over to Firebase.

Parse JavaScript SDK and Promise Chaining

邮差的信 提交于 2019-11-27 03:40:37
问题 I have created a Background Job in Parse Cloud Code that sends out email notifications based on a date in one of my Parse classes. Here is the idea: Query the class that contains the date. Iterate over each object returned and check the date field. If the date is equal to today, send out an email notification, change the date to null and save it back to Parse. However, it seems that not all the objects are saved back to Parse. I suspect this an issue with my promise chains, but I am having a

In cloud code, call a Parse.Cloud.run function more than once in series

泪湿孤枕 提交于 2019-11-26 22:01:35
问题 Say you have a "define" Parse.com cloud code function... Parse.Cloud.define("exampleDefineFunction", function(request, response) { ... response.success("ok") ... response.error("doh") }); I want to make another cloud code function, which calls that define function a number of times in series , with one waiting for the next, much as in a serial promise chain Can this be done? 回答1: I think this should do the trick! In this scenario we want to use Parse.Promise.when() Returns a new promise that

Parse request.object.get(“KEY”) always returns undefined

折月煮酒 提交于 2019-11-26 14:43:52
问题 I have a strange problem over here. I have a project built with Parse.com as a backend (using cloudcode to verify some things when a connection to the database is made). Everything works just as it should do. But here comes the problem. Another developer reported to me that there is something wrong because he is getting 'undefined' every time he tries to call request.object.get('KEY') in CloudCode. This developer uses the exact same codebase as I do. So I decided to have a look at it. While