Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var lastInsertId;
- loginData={
- userName: req.body.txtUsername,
- password: req.body.txtPassword,
- active:1,
- createdOn:new Date(),
- updatedOn:new Date()
- };
- var dbo = db.db("test");
- dbo.collection("login").insertOne(loginData, function(err, result) {
- if (err) throw err;
- lastInsertId=result.insertedId;
- });
- if(lastInsertId){
- usersData={
- email: req.body.txtEmail,
- firstName: req.body.txtFirstName,
- lastName:req.body.txtLastName,
- mobileNumber:req.body.txtMobileNumber,
- login_id:lastInsertId,
- active:1,
- createdOn:new Date(),
- updatedOn:new Date()
- };
- dbo.collection("users").insertOne(usersData, function(err, result) {
- if (err) throw err;
- console.log('saved to users');
- });
- }
Add Comment
Please, Sign In to add comment