If my schema is as follows:
var Configuration = describe('Configuration', function () {
property('name', String);
set('restPath', pathTo.configurations);
});
var Webservice = describe('Webservice', function () {
property('wsid', String);
property('url', String);
});
Configuration.hasMany(Webservice, { as: 'webservices', foreignKey: 'cid'});
and that reflects data like so:
var configurationJson = {
"name": "SafeHouseConfiguration2",
"webServices": [
{"wsid": "mainSectionWs", "url":"/apiAccess/getMainSection" },
{"wsid": "servicesSectionWs", "url":"/apiAccess/getServiceSection" }
]
};
shouldn’t I be able to seed mongoDB with the following:
var configSeed = configurationJson;
Configuration.create(configSeed, function (err, configuration) {
)};
which would create the following tables with data from the json object:
- Configuration
- Webservice
Since this did not work as I had expected, my seed file ended up as the following:
/db/seeds/development/Configuration.js