Skip to content

Made findAndModify() callbacks use findAndModifyWriteOpResult#159

Open
Root-Core wants to merge 3 commits intosergeyksv:masterfrom
Root-Core:findAndModify
Open

Made findAndModify() callbacks use findAndModifyWriteOpResult#159
Root-Core wants to merge 3 commits intosergeyksv:masterfrom
Root-Core:findAndModify

Conversation

@Root-Core
Copy link
Contributor

The mongodb-native-driver > 1.x does return an findAndModifyWriteOpResult in the callback.

This change should mimic the behaviour of mongo-native-driver for findAndModify().
It makes Mongoose work correctly with the TingoDB in many cases.

I also adapted the tests, but I'm not too sure about these changes as the tests seem to not work under windows at all.

The mongodb-native-driver > 1.x does return an
[findAndModifyWriteOpResult](http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#~findAndModifyWriteOpResult)

This change should mimic the behaviour of mongo-native-driver for
`findAndModify()`.
@sergeyksv
Copy link
Owner

Do you mind to make this behavior optional and depend on new option like apiLevel. I mean this https://github.com/sergeyksv/tingodb#requiretingodboptions. So final code can looks like:

var tinngo = require('tingodb')({apiLevel:200});

200 is like 2.00, I hope this will be enough to cover native driver variations. Changes for existing tests can be reverted, but instead new one has to be added which will check that with apiLevel:200 findAndModify will behave as you expect it to behave.

@sergeyksv
Copy link
Owner

@Root-Core I'd rewrote your fix by making it configurable per my suggestion. Can you check please if your fine with this. See https://github.com/sergeyksv/tingodb/pull/170/files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments