noderman
noderman

Reputation: 1944

Sails.js Waterline ORM: .findOrCreate() does not have .populate() method

I am working with a Model association and everything works fine. However, I just noticed the Model findOrCreate() method does not have a populate() method:

TypeError: Model.findOrCreate(...).populate is not a function

Is this by design, and if so, what would be the reason? Seems like an important feature to me.

Upvotes: 0

Views: 598

Answers (1)

Martial
Martial

Reputation: 1562

Sails can't know if the record will be found or created. In the case the record is created, the method findOrCreate() act like create() method. Since this method does not have populate() method, findOrCreate() can't have it either.

Upvotes: 3

Related Questions