Reputation: 109
I'm trying to store array of Object Id's of another model.
Sub Service
skills: {
collection: 'subservice',
via: 'contractors'
},
Contractor Model
contractors : {
collection: 'contractor',
via: 'skills'
},
and this solution didn't worked... How to store array of ObjectID's in Mongo with Sails?
Upvotes: 1
Views: 811
Reputation: 380
In this two models you are using via
so you must specify which model is dominant:
Sub Service
skills: {
collection: 'subservice',
via: 'contractors',
domiant: true
},
Contractor Model
contractors : {
collection: 'contractor',
via: 'skills'
},
More info: http://sailsjs.org/documentation/concepts/models-and-orm/associations/dominance
Upvotes: 2