feat (mongoose): use mongoose-bird to promisify the mongoose API#503
feat (mongoose): use mongoose-bird to promisify the mongoose API#503pentateu wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
Changing this line to: var validationError = function(res, code) { should resolve your build error.
There was a problem hiding this comment.
cool.thanks for the heads up.
|
@pentateu not a big deal, but it('should fail when saving a duplicate user', function() {
return user.saveAsync()
.then(function() {
var userDup = new User(user);
return userDup.saveAsync();
})
.should.be.rejected;
});
it('should fail when saving without an email', function() {
user.email = '';
return user.saveAsync().should.be.rejected;
}); |
|
@pentateu what are your thoughts on mongoomise? |
|
@kingcody I was not aware of mongoomise when I did mongoose-bird. It looks good. Anyway having options is good, but is comes with a cost of complexity which in the case of generator is a relevant topic. mongoomise benchmark also points to blubird as having the best performance. That is why I have chosen to use blubird. In summary I would stick with mongoose-bird for now. |
|
Looks great. Much easier to read these methods when they're using promises. |
|
Could you update it against canary? |
|
Yeah.. I'll find some time this weak to rebase on Canary and also do the unit test updates suggested using chai-as-promise |
There was a problem hiding this comment.
@pentateu please correct me if I'm wrong, but shouldn't this be:
return updated.saveAsync()
.then(function() {
return updated;
});I actually had problems with passing a callback. Perhaps I was doing something wrong?
There was a problem hiding this comment.
yes :-) I have it fixed now.
|
Also @pentateu your build is failing because canary no longer uses You should be able to simply remove |
|
@kingcody thanks for the heads-up. |
|
This should be closed in favour of #520, yes? |
|
Sorry for the delay.. I have fixed the issues with lodash not being inside the mongoose condition. |
|
Closed with #520 |
No description provided.