Skip to content

Latest commit

 

History

History
31 lines (27 loc) · 444 Bytes

section53.4.md

File metadata and controls

31 lines (27 loc) · 444 Bytes

Section 53.4: Read data

  • ECMA6:
User.findOne({
  name: 'stack'
}, (err, user) => {
  if (err) throw err;
  if (!user) {
    console.log('No user was found');
  } else {
    console.log('User was found');
  }
});
  • ECMA5.1:
User.findOne({
  name: 'stack'
}, function (err, user) {
  if (err) throw err;
  if (!user) {
    console.log('No user was found');
  } else {
    console.log('User was found');
  }
});