Start a new topic

Get the entity _id after saving it

Hi Guys,


Is there anywhere I can get the entity _id after saving it?

var visitor = modules.kinvey.entity();

visitor.name = request.body.name;

visitor.phone = request.body.phone;

visitor.email = request.body.email;


modules.collectionAccess.collection('visitor').save(visitor, function (err, obj) {


   logger.info(obj._id); // exception here


});


regards,

Mark Thien


Oh yeah I was trying visitor._id and it works

Hi Mark,


Please try replacing

  

logger.info(obj._id); // exception here

  

with

 

    logger.info(visitor._id);

 


Let me if this helps.


Regards,

Wani

Login or Signup to post a comment