mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
- migration guide 2.7.4 review
This commit is contained in:
@@ -5,7 +5,7 @@ description: How to migrate your application to Meteor 2.7.4.
|
||||
|
||||
Meteor `2.7.4` introduce the new MongoDB Package Async API. For a complete breakdown of the changes, please refer to the [changelog](http://docs.meteor.com/changelog.html).
|
||||
|
||||
For this new async API, we have new methods like `findOneAsync`, which behaves exactly like the `findOne` method, but it now returns a promise that needs to be solved to get the data.
|
||||
For this new async API, we have new methods like `findOneAsync`, which behaves exactly like the `findOne` method, but it now returns a promise that needs to be resolved to get the data.
|
||||
|
||||
<h3 id="why-like-this">Why this is important?</h3>
|
||||
|
||||
@@ -48,7 +48,7 @@ Yes and no.
|
||||
|
||||
If you're not using any constructor, like `MongoInternals.RemoteCollectionDriver`, then yes. Your app will run normally.
|
||||
|
||||
But if you're using a construction like that one, then an error be thrown because these are async now. In this case, you have two options:
|
||||
But if you're using a construction like that one, then an error will be thrown because these are async now. In this case, you have two options:
|
||||
- You can wrap the call in an async function, like so:
|
||||
```js
|
||||
async function Connection() {
|
||||
@@ -60,7 +60,9 @@ But if you're using a construction like that one, then an error be thrown becaus
|
||||
const Connection = new MongoInternals.RemoteCollectionDriver(/.../).await();
|
||||
```
|
||||
|
||||
The last option is easier for a quick fix. Just bear in mind that the function `.await()` in working with Fibers, meaning that it'll be deprecated in the future.
|
||||
The last option is easier for a quick fix. Just bear in mind that the function `.await()` is working with Fibers, meaning that it'll be deprecated in the future.
|
||||
|
||||
Also, remember to add the `ecmascript` package, otherwise the async won't work. The `ecmascript` package has the build plugin that compiles await and async to run within fibers.
|
||||
|
||||
<h2 id="older-versions">Migrating from a version older than 2.7.4?</h2>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user