I'm trying to save a Parse.com Object with a custom objectId, but the object is not saved at all. I'm using the Javascript API. Here is an example:
var newsfeed = new Parse.Object("Newsfeed");
newsfeed.id = 'customid';
newsfeed.save();
But when looking at the list of Newsfeed object on Parse data it is not there.
If this is not possible there should be at least an error message.
Thank you for your feedback. We use the issue tracker here to track valid bugs in our SDK. Your question seems to be more about how to use Parse. Could you check out the following resources?
Creating objects with custom Ids is not supported behavior.
If you attempt the save above, it'll return from the server with a 404 error code. Saving is an asynchronous process, so .save() returns a Parse.Promise. If you wrote your code like this:
var newsfeed = new Parse.Object("Newsfeed");
newsfeed.id = 'customid';
newsfeed.save().then(function() {
// on success
}, function(error) {
// on error
console.log('an error occurred');
});
you'll find that it prints out 'an error occurred.' The error case of the promise is designed to let developers write custom error handlers.
Thanks @andrewimm.
Is there any reason why using custom objectIds is allowed when using the import tool and it is not allowed programatically through the JS SDK?
I have the same issue and plan to use direct mongodb request when creating those objects, then I'll use standard parse.
I would like that this become possible with parse.
This is possible today!
@rhuanbarreto
How?
PR #6177
Hmm forgive me, but I am unable to find PR#6177. @rhuanbarreto would you mind providing a link? Thank you!
https://github.com/parse-community/parse-server/pull/6177
You need to make a request to the REST API to have it working. The JS SDK doesn't yet support it. There's an open issue for it https://github.com/parse-community/Parse-SDK-JS/issues/1097
@rhuanbarreto , does this support in swift API too?
Most helpful comment
I would like that this become possible with parse.