Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Made findAndModify() callbacks use findAndModifyWriteOpResult #159

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

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