The future of *Async for Collection methods

It seems there is some confusion on if the *Async suffix will be eventually removed from Collection methods. From what I understand based on the below convos, it will eventually be removed but not in 3.0. To write isomorphically in 3.0, you’ll need to use the *Async methods.

From this convo in the Meteor slack:

And from this convo on github.


Removing the *Async suffix at some point makes sense to align with Mongo / the Node driver. When this happens, it means that findOne, fetch, insert, etc. will all be async functions that will need to be awaited.

What’s not clear is:

  1. When would *Async be removed? Soon after 3.0 or much later?
  2. What will happen to the synchronous client-side methods when it is? Using *Local is one idea that has been discussed a bit: Support `*Local` methods in Collections API · meteor/meteor · Discussion #12644 · GitHub

Would be great if someone on the Meteor team could provide some clarity even if the definitive plan hasn’t been solidified.

If anyone has better ideas on how to handle #2, please share.

I don’t think *Async functions get removed soon. It will be there for very long time, maybe util version 4+.
I don’t see any reason for doing that. Instead, they will make the functions without Async suffix async.
Like findOne, fetch… they will be async functions.
So we will need to add await keyword before that: await Col.findOne(), await Col.find().fetch()

Then they should introduce *Sync function for the front-end to work with mini-mongo: findOneSync(), find().fetchSync()… It will be easier for people to migrate their apps.

Agree. We’re saying the same thing. I should have been clearer in the original post :slightly_smiling_face:

I think it’d be helpful for people to understand when this might happen after 3.0 and when *Sync or *Local might be introduced.

1 Like

You guys have the right idea, but to reinforce it:

Much much later. You don’t need to worry about this now.

It’s still open to discussion. But most people like the *Local option. But that’s the idea.

3 Likes

This would be tremendously helpful.

1 Like