mongoose-transactions icon indicating copy to clipboard operation
mongoose-transactions copied to clipboard

transaction.insert('Order', oder) does return order id but does not save on DB

Open VihagaYohan opened this issue 4 years ago • 1 comments

I want to save the order to MongoDB (cloud-hosted ). However, if I use transaction.insert('Order', order) to save data, it does return the ID of the saved object but does not save on DB. ` async function start() { try { const orderId = transaction.insert("Order", order);

  res.status(200).json({
    sucess: true,
    data: orderId,
  });
} catch (error) {
  console.error(error);
  const rollbackObj = await transaction.rollback().catch(console.error);
  transaction.clean();
}

}

start(); `

VihagaYohan avatar Oct 22 '20 09:10 VihagaYohan

Have you solved it?I also cannot save into DB. When transaction,run(), will always be loaded.Can't get to the next step

dazed-daydreamer avatar Nov 27 '20 07:11 dazed-daydreamer