title: Mongoose / Mongodb update return value and error handling
body: <p>I am a little confused about the return value of Mongoldb update and how should I handle error with it.</p>
  
  <p>I am using Node.js, Express.js and Mongoose.js as my Mongodb driver</p>
  
  <p>As I look through many tutorial, the only way of error handling I saw is ...</p>
  
  <p>Example: A simple user schema .. and I want to update telephoneNumber</p>
  
  <pre><code>Users 
  
  { 
    email : abc@abc.com,
    telephoneNumber : 123456
  }
  </code></pre>
  
  <p>Example of error handling written in node.js that many tutorial taught me</p>
  
  <pre><code> Users.update({email: abc@abc.com}, {'$set': {telephoneNumber : 654321}, function(err, result){
        if(err){
             //err
        }else if(!result){
             //update not success
        }else{
             //update success
        }
   });
  </code></pre>
  
  <p>but as I look through Mongodb documentation, I found out that update return WriteConcern value, which return something like this</p>
  
  <pre><code> {
        "ok" : 1,             // update with no err
        "nModified" :1,        // successfully update 1 user
        "n" : 1               // found 1 
   }
  </code></pre>
  
  <p>So my question is, should I handle my error like this instead, so I would know more about the failures of update...</p>
  
  <pre><code>  Users.update({email: abc@abc.com}, {'$set': {telephoneNumber : 654321}, function(err, result){
        if(err || result.ok === 0){
             //err
        }else if(result.nModified === 0){
             //update fail
        }else if(result.n === 0){
             //could not be found 
        }else{
             //update success
        }
   });
  </code></pre>
  
  <p>Is this a bad approach to update handling in mongoose/mongodb?</p>
  
  <p>Thanks!! :)</p>