Guest User

Untitled

a guest
Mar 15th, 2018
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. var lastInsertId;
  2. loginData={
  3. userName: req.body.txtUsername,
  4. password: req.body.txtPassword,
  5. active:1,
  6. createdOn:new Date(),
  7. updatedOn:new Date()
  8. };
  9. var dbo = db.db("test");
  10. dbo.collection("login").insertOne(loginData, function(err, result) {
  11. if (err) throw err;
  12. lastInsertId=result.insertedId;
  13. });
  14.  
  15. if(lastInsertId){
  16. usersData={
  17. email: req.body.txtEmail,
  18. firstName: req.body.txtFirstName,
  19. lastName:req.body.txtLastName,
  20. mobileNumber:req.body.txtMobileNumber,
  21. login_id:lastInsertId,
  22. active:1,
  23. createdOn:new Date(),
  24. updatedOn:new Date()
  25. };
  26.  
  27. dbo.collection("users").insertOne(usersData, function(err, result) {
  28. if (err) throw err;
  29. console.log('saved to users');
  30. });
  31. }
Add Comment
Please, Sign In to add comment