Skip to content

Instantly share code, notes, and snippets.

@thstarshine
Last active December 17, 2015 16:36
Show Gist options
  • Select an option

  • Save thstarshine/7df5cd021a8d0b9c5976 to your computer and use it in GitHub Desktop.

Select an option

Save thstarshine/7df5cd021a8d0b9c5976 to your computer and use it in GitHub Desktop.
mongoose w/ bluebird promise performance test
mongoose schema:
update: function(row){
return this.update({}, row).exec();
}
// method 1
batchUpdate: function(rows){
return Promise.map(rows, function(row){
return self.update({}, row).exec();
});
}
another js:
// method 2
return Promise.map(rows, function(row){
return model.update(row);
});
// method 1 is twice faster than method 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment