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

Why fastJoin is preferred over using populate? #622

Open
soullivaneuh opened this issue Apr 11, 2021 · 1 comment
Open

Why fastJoin is preferred over using populate? #622

soullivaneuh opened this issue Apr 11, 2021 · 1 comment

Comments

@soullivaneuh
Copy link

soullivaneuh commented Apr 11, 2021

This sentence is repeated on both hooks related documentation sections:

fastJoin is preferred over using populate

But I didn't find any link or explanation about why.

So I am asking: why? 🙂

@soullivaneuh
Copy link
Author

I am asking because I consider populate more "easier to use" than fastJoin. We can have the related data with just some configuration lines:

I used fastJoin to calculate a price of a record:

fastJoin(
  {
    joins: {
      totalPrice: () => async (ride) => {
        ride.totalPrice = getTotalPrice(ride.price);
      },
    },
  },
),

This works, but you will certainly say I should use alterItem for that.

Plus, you show alterItem example on the documentation to load something that looks like a relation:

alterItems(rec => {
  rec.userRecord = (async () => await service.get(...) )()
})

Well, I am pretty confused. 🙃

I hope you may clarify this. 👍

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

1 participant