1

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?

Community
  • 1
  • 1
Talib Allauddin
  • 123
  • 3
  • 16
  • Can you clarify what "it didn't work" means? What did you try, what was the expected result, and what actually happened? – sgress454 Oct 11 '16 at 16:49

1 Answers1

2

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

SkyQ
  • 380
  • 2
  • 9