Skip to content
This repository has been archived by the owner on Mar 15, 2023. It is now read-only.

Update method shows deprecation warning #122

Closed
waltherjj opened this issue Sep 18, 2018 · 5 comments
Closed

Update method shows deprecation warning #122

waltherjj opened this issue Sep 18, 2018 · 5 comments
Labels

Comments

@waltherjj
Copy link

Steps to reproduce

  • [] Generate basic feathers app (REST) with feathers-cli.
  • [] Generate new MongoDB service with feathers-cli.
  • [] Create new MongoDB database and collection, insert empty document.
  • [] Run a put request to the mongodb-service endpoint with document id.

Expected behavior

Document gets updated, no warning messages shown.

Actual behavior

Document gets updated, but a deprecation warning is shown:

DeprecationWarning: collection.update is deprecated. Use updateOne, updateMany, or bulkWrite instead

Reason: The update method should use updateOne internally.

System configuration

Tell us about the applicable parts of your setup.

Module versions (especially the part that's not working):
"@feathersjs/express": "^1.2.6",
"@feathersjs/feathers": "^3.2.2",
"feathers-mongodb": "^3.3.0",
MongoDB 3.6.7

NodeJS version:
8.12.0

Operating System:
Linux Mint 18

@claustres
Copy link
Contributor

This is also applicable to others methods like delete() and insert().

@Gerigot
Copy link
Contributor

Gerigot commented Nov 13, 2018

I've forked this version and adjusted the create (insert => insertMany insertOne ) deprecation version, if you want I can try to fix all of this kind of error and make a pull request let me know if it's ok

@daffl
Copy link
Member

daffl commented Nov 13, 2018

Yes, that is always very welcome.

@Gerigot
Copy link
Contributor

Gerigot commented Nov 14, 2018

OK I'll work on that, I've seen that updateOne and updateMany are quite different from the update itself.

daffl pushed a commit that referenced this issue Nov 15, 2018
* added a control to the create method and modified the behavior

* removed deprecation warning

* added two test maybe are duplicated but I wanted to be sure that patch  worked fine

* linted the test file

* Ternary operators
@daffl
Copy link
Member

daffl commented Nov 15, 2018

Closed via #126

@daffl daffl closed this as completed Nov 15, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants