title: How to use findAndModify with a Node.js MongoDB driver?
body: <p>What is wrong with the code below? </p>
  
  <pre><code>db.get().collection('bars').findAndModify({
      barID: req.body.button
  },{
      $push: {
          usersfbID: req.body.profileUser[0].facebookID,
          usersDocID: req.body.profileUser[0]._id
      }
  },{
      new: true
  }, function(err, doc){
      if(err){
          throw err;
      }if(doc){
          console.log('Existing document updated successfully');
          console.log(doc);
      }
  });
  </code></pre>
  
  <p>I always get the same error, </p>
  
  <blockquote>
    <p>MongoError: exception: nextSafe(): { $err: "Can't canonicalize query:
    BadValue bad sort specification", code: 17287 }</p>
  </blockquote>
  
  <p>What am I doing wrong? Am I misusing the $push operator? Do I need to provide quotes around some of the key value pairs? This findAndModify method is driving me crazy. I have absolutely no idea what I am doing wrong. </p>
  
  <p>Note: I have been through the other questions on SO regarding findAndModify, but none of those solutions is working for me. I'm sure its a small error regarding the syntax for the function. </p>