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

The "old API" warning is unclear about what new API to use instead. #12646

Closed
striezel opened this issue May 19, 2023 · 4 comments · Fixed by #12650
Closed

The "old API" warning is unclear about what new API to use instead. #12646

striezel opened this issue May 19, 2023 · 4 comments · Fixed by #12650
Labels
missing-docs Documentation or history entry is missing for the PR

Comments

@striezel
Copy link
Contributor

The migration guide for Meteor 2.12 mentions a way to enable warnings about an old API, so out of curiosity I enabled it on my project. It looks like every use of methods like remove, insert or findOne (and maybe others, too) on MongoDB collections trigger that warning. That's fine so far, because it informs me what will be removed in Meteor 3.

However, neither the warning nor the migration guide mention what API should be used instead. That makes the warning kind of pointless, because even if I am willing to migrate to a newer API, I do not have any idea what API that should be. So I checked the documentation on collections and it looks like insert etc. are still the way to use MongoDB collections. 🤔

So the question is: What should Meteor users use instead, any why does the documentation not contain a pointer to the new API? That would make migration easier.

@ToyboxZach
Copy link
Contributor

There are new *async versions of each method that should be used

remove -> removeAsync
insert -> insertAsync

etc
On the server you will now have to await each result as fibers is being removed

@striezel
Copy link
Contributor Author

Good to know.

This move to asynchronous versions should also be mentioned in the migration guide and the documentation for Mongo.Collection. Otherwise people will probably still keep using the old versions of those methods.

@Grubba27 Grubba27 added the missing-docs Documentation or history entry is missing for the PR label May 23, 2023
@Grubba27
Copy link
Contributor

I think the only docs about those methods are in 2.8 migration guide. Will make this a docs issue for this reason.
Will close this one as I think it is "solved" and create another one regarding these missing docs. Sounds good?

@striezel
Copy link
Contributor Author

I think the only docs about those methods are in 2.8 migration guide. Will make this a docs issue for this reason. Will close this one as I think it is "solved" and create another one regarding these missing docs. Sounds good?

Yes, #12650 together with #12649 should solve this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
missing-docs Documentation or history entry is missing for the PR
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants