code: function encode (schema, doc, toEncrypt) {
      if (!doc) return false
      var method = (toEncrypt) ? encrypt : decrypt
        , obj = (doc.toObject) ? doc.toObject() : doc
  
      // Traverse through all schema paths
      schema.eachPath(function (name, path) {
        var val = nestedPath(doc, name)
  
        // ObjectID paths
        if (path.instance === 'ObjectID' && val) {
          nestedPath(obj, name, method(val.toString()))
        }
  
        if (path.casterConstructor) {
          // Array of DBRefs
          if (!!~path.casterConstructor.toString().indexOf('ObjectId')) {
            nestedPath(obj, name).forEach(function (v, k) {
              nestedPath(obj, name)[k] = method(val[k].toString())
            })     
          // Array of embedded schemas
          } else if (!!~path.casterConstructor.toString().indexOf('EmbeddedDocument')) {
            nestedPath(obj, name).forEach(function (v, k) {
              nestedPath(obj, name)[k] = encode(path.schema, val[k], toEncrypt)
            })
          }
        }
      })
      return obj
    }
docs: Recursively encode all ObjectID's in schema