title: Express 500 Error: Argument passed in must be a single String of 12 bytes or a string of 24 hex characters
body: <p>I am trying to do simple update operation in mongodb. I have done it successfully using node.js, Express.js and Jade.js. Now I want to use restify.js in my existing application for rest api. but it is throwing "Express 500 Error: Argument passed in must be a single String of 12 bytes or a string of 24 hex characters"</p>
  
  <p>This is my index.jade (form part):</p>
  
  <pre><code>form( method="get", action="/employee/:id/edit")
    input(name="_id", type="hidden", value=employee._id.toHexString())
    input(name="com", type="hidden", value=''+employee.comment)
    input(name="titl", type="hidden", value=''+employee.title)
    input(name="nam", type="hidden", value=''+employee.name)
    input(id="edit", value="Edit", type="submit", class="btn btn-primary")
  </code></pre>
  
  <p>This is my employee_edit.jade:</p>
  
  <pre><code>form( method="post")
    span.label My comment type is :
    select(name='title')
      - for (var i=0; i&lt;2; i++)
        if titl==arr2[i]
          option(value=arr2[i], selected='selected')
            =''+arr2[i]
        else
          option(value=arr2[i])
            =''+arr2[i]
    span.label My comment is for :
    select(name='name', selectedInex=3)
      - for (var i=0; i&lt;22; i++)
        if nam==arr[i]
          option(value=arr[i], selected='selected')
            =''+arr[i]
        else
          option(value=arr[i])
            =''+arr[i]
    span.label Comment :
    textarea(rows='4', cols='50', name='comment', id='com')
      =''+com
    input(type="submit", value="Update")
  </code></pre>
  
  <p>This is my app.js file which is starting point of my application:</p>
  
  <pre><code>var express = require('express')
  , routes = require('./routes')
  , user = require('./routes/user')
  , http = require('http')
  , path = require('path')
  , EmployeeProvider = require('./employeeprovider').EmployeeProvider
  , myDate=require('date-utils');
  
    var restify = require('restify');
    var restServer = restify.createServer({ name: 'my-api' });
  
  var app = express();
  app.configure(function(){
  app.set('port', 3333);
  app.set('views', __dirname + '/views');
  app.set('view engine', 'jade');
  app.set('view options', {layout: false});
  app.use(express.favicon());
  app.use(express.logger('dev'));
  app.use(express.bodyParser());
  app.use(express.methodOverride());
  app.use(app.router);
  app.use(require('stylus').middleware(__dirname + '/public'));
  app.use(express.static(path.join(__dirname, 'public')));
  });
  app.configure('development', function(){
  app.use(express.errorHandler());
  });
  var employeeProvider= new EmployeeProvider('localhost', 27017);
  
    //Routes of express jade
    //update an employee Feedback
  app.get('/employee/:id/edit', function(req, res) {
  employeeProvider.findById(req.param('_id'), function(error, employee) {
    res.render('employee_edit',
             { 
                     //employee: employee,
                      empId: req.param('_id'),
                      com: req.param('com'),
                      titl: req.param('titl'),
                      nam: req.param('nam')
  
              });
      });
  });
  
   //save updated employee Feedback
   app.post('/employee/:id/edit', function(req, res) {
      employeeProvider.update(req.param('_id').toString(),{
              title: req.param('title'),
              name: req.param('name'),
              comment: req.param('comment'),
              created_at: new Date()
      }, function(error, docs) {
              res.redirect('/')
      });
    });
  
   app.listen(3333); 
  </code></pre>
  
  <p>I have written employeeprovider.js for mongodb connection:</p>
  
  <pre><code>var Db = require('mongodb').Db;
  var Connection = require('mongodb').Connection;
  var Server = require('mongodb').Server;
  var BSON = require('mongodb').BSON;
  var ObjectID = require('mongodb').ObjectID;
  
  EmployeeProvider = function(host, port) {
  this.db= new Db('node-mongo-employee', new Server(host, port, {safe: false}
  {auto_reconnect: true}, {}));
  this.db.open(function(){});
  };
  
  
  EmployeeProvider.prototype.getCollection= function(callback) {
  this.db.collection('employees', function(error, employee_collection) {
   if( error ) callback(error);
   else callback(null, employee_collection);
   });
  };
  
  EmployeeProvider.prototype.update = function(employeeId, employees, callback) {
  this.getCollection(function(error, employee_collection) {
  console.log('now in update'+employeeId);
     if( error ) callback(error);
    else {
      employee_collection.update(
                                      {_id: employee_collection.db.bson_serializer.ObjectID.createFromHexString(employeeId)},
                                      employees,
                                      function(error, employees) {
                                              if(error) callback(error);
                                              else callback(null, employees)       
                                      });
     }
     });
   };
  exports.EmployeeProvider = EmployeeProvider;
  </code></pre>
  
  <p>now by clicking edit button on index.jade it should open employee_edit.jade for editing employee. but it showing the error. address comes in address bar is:</p>
  
  <pre><code>http://localhost:3333/employee/:id/edit?_id=5215ad336ad5d6780d000001&amp;com=dfsa&amp;titl=Suggestion&amp;nam=Abhishek
  </code></pre>
  
  <p>It works if i remove 8th and 9th line of app.js</p>
  
  <pre><code>var restify = require('restify');
  var restServer = restify.createServer({ name: 'my-api' });
  </code></pre>
  
  <p>but i want to use restify in my app, what can i do???
  thanx..!</p>