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

Meteor 2.6.1 Issue: [MONGODB DRIVER] Warning: collection.remove is deprecated. Use deleteOne, deleteMany, or bulkWrite instead. #24

Open
DanielDornhardt opened this issue Feb 25, 2022 · 3 comments

Comments

@DanielDornhardt
Copy link

The Title pretty much describes it.

I get a warning on the server console that says:

[MONGODB DRIVER] Warning: collection.remove is deprecated. Use deleteOne, deleteMany, or bulkWrite instead.
I can see that it is triggerd from the xolvio:cleaner package by setting the NODE_OPTIONS="--trace-warnings" environment variable:

image

@DanielDornhardt
Copy link
Author

We're grateful for this package and it's a "classic" in our meteor setup, so we're pretty much used to it just doing what it does! Would be cool if someone could have a look, I don't have the time to investigate this currently.

If it's not possible to fix at all, eventually maybe we can do a fork + MR, but it might take some time.

@jrkinclus
Copy link

Looks like just changing the one line at https://github.com/xolvio/cleaner/blob/master/cleaner.js#L25 to
var remove = Meteor.wrapAsync(appCollection.deleteMany, appCollection);
should do the trick.

Not sure how the package version should change with this? Go up to 0.5.0 or 1.0.0? So that apps possibly using an older version of Meteor and MongoDB would stay on 0.4.0.

@drone1
Copy link

drone1 commented May 11, 2022

Thank you @jrkinclus for doing the work to figure that out. I've made a fork with your change, which works for me. The fork also exports the resetDatabase function, since I'm using it as an NPM module.

I'll submit a pull request, but in the meanwhile, feel free to use it if you'd like.

meteor npm install --save git+https://github.com/drone1/xolvio-cleaner

Import like this:

```import { resetDatabase } from 'cleaner'``

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

No branches or pull requests

3 participants