code: function(doc){
      if(doc === null || typeof(doc) !== 'object'){
          return;
      }
  
      for(var key in doc){
          if(key[0] === '$'){
              throw new Error('Document fields can not start with "$"');
          }
          if(key.indexOf('.') !== -1){
              throw new Error('Document fields can not contain "."');
          }
          verifyDoc(doc[key]);
      }
  }
docs: http://docs.mongodb.org/manual/reference/limits/#Restrictions-on-Field-Names