1

For example, in my local parse server every time I save the object it creates the new unique object id for that particular object. But when I deploy it in live server(ec2 or some other sites) it updates the data in the same object id. (If first time I save an object. it shows me the objectid like 67XBVFA but when i create another object it updates the value in the same object id 67XBVFA.). By the way I am using mongodb for the database. Here is the simple basic which save the same object id eventhough I change the values of the field.

sampleobject.set("name", "xxxx");
sampleobject.set("email", "[email protected]");
sampleobject.save(null).then(objectstatus => {
   res.success(200, objectstatus
)}

Why it correctly generate a unique object id in my localhost. But updates in the same object id in live instances?

1 Answer 1

0
const sampleobjects = Parse.Object.extend("sampleClass");
const sampleobject = new sampleobjects();

The problem is I declared this in outside of the cloud function. Like this.

const sampleobjects = Parse.Object.extend("sampleClass");
const sampleobject = new sampleobjects();

Parse.Cloud.define('sampleFunction', (res) => {
    sampleobject.set("name", "xxxx");
    sampleobject.set("email", "[email protected]");
    sampleobject.save(null).then(objectstatus => {
        res.success(200, objectstatus
    )}
});

So every time it checks it initiates the same object id.

So when I declared it inside like this.

Parse.Cloud.define('sampleFunction', (res) => {
    const sampleobjects = Parse.Object.extend("sampleClass");
    const sampleobject = new sampleobjects();
    sampleobject.set("name", "xxxx");
    sampleobject.set("email", "[email protected]");
    sampleobject.save(null).then(objectstatus => {
        res.success(200, objectstatus
    )};
});

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.