-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Description
Sails version: 1.1.0
Node version: 8.10
NPM version: 5.6.0
DB adapter name: sails-mysql
DB adapter version: 1.0.1
Operating system: Debian GNU/Linux 8 (jessie)
I'm running my project on docker image with *nodev8.10*. I have a model with a single association with another model, example
/*Pet*/
module.exports = {
attributes: {
name: { type: 'string' },
petType: {
model: 'pettype'
}
}
}
/*PetType*/
module.exports = {
attributes: {
name: { type: 'string' },
}
}
Then I try to populate my Pet model with specific PetType fields, like this:
await Pet.find().populate('petType', { select: ['name'] });
And I get the following error:
Could not populate
petType
because of ambiguous usage. This is a singular ("model") association, which means it never refers to more than one associated record. So passing in subcriteria (i.e. as the second argument to.populate()
) is not supported for this association, since it generally wouldn't make any sense. But that's the trouble-- it looks like some sort of a subcriteria (or something) was provided!\n(Note that subcriterias consisting ONLY ofomit
orselect
are a special case that does make sense. This usage will be supported in a future version of Waterline.)\n\nHere's what was passed in:\n{ select: [ 'name' ] }