code: function deepCopy(obj, strictKeys) {
    var res;
  
    if (
      typeof obj === 'boolean' ||
      typeof obj === 'number' ||
      typeof obj === 'string' ||
      obj === null ||
      util.isDate(obj)
    ) {
      return obj;
    }
  
    if (util.isArray(obj)) {
      res = [];
      obj.forEach(function(o) {
        res.push(deepCopy(o, strictKeys));
      });
      return res;
    }
  
    if (typeof obj === 'object') {
      res = {};
      Object.keys(obj).forEach(function(k) {
        if (!strictKeys || (k[0] !== '$' && k.indexOf('.') === -1)) {
          res[k] = deepCopy(obj[k], strictKeys);
        }
      });
      return res;
    }
  
    return undefined; // For now everything else is undefined. We should probably throw an error instead
  }
docs: Deep copy a DB object
  The optional strictKeys flag (defaulting to false) indicates whether to copy everything or only fields
  where the keys are valid, i.e. don't begin with $ and don't contain a .