Skip to content

Instantly share code, notes, and snippets.

@tblobaum
Created September 1, 2011 08:04
Show Gist options
  • Save tblobaum/1185679 to your computer and use it in GitHub Desktop.
Save tblobaum/1185679 to your computer and use it in GitHub Desktop.
filterMongoosePrivates: function(doc) {
var obj = {};
var keys = _.reject(_.keys(doc._doc), function (key) {
return key.indexOf("_") === 0;
});
for (var i=0,j=keys.length;i<j;i++) {
obj[keys[i]] = doc[keys[i]];
}
return obj;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment