-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fixture itemName/collection name must be same? #11
Comments
@roger-kaybus k will look into it. I remember thinking at one point that the interface seemed redundant, but there was a reason I made the decision and I think it has to do with the way mongoose works. I'll look into it and let you know. |
Reviewed some of the code fairly quickly. I think my intention was as follows. A little background on Mongoosejs, by default it will take whatever 'ModelKey' you pass into There are problems with Mongoosejs auto-generating collection names, specifically I had an instance of the model 'Facility' which was generating So... with that said I reviewed my project that has multiple mis-matching itemName / collection names and they work fine... I think your problem might be in setting two different values you need to map your fixture.collection to the custom collection name you define on your scheme module.exports = function(mongoose){
var facilitySchema = mongoose.Schema({
internalName:{type:String},
name:{type:String},
},
// extra options, this overrides the default collection name
// that would be set by model as facilitys
{
collection:'facilities'
}
);
return facilitySchema;
}; Let me know if this solves your problem. Maybe I'll see what my options are for warning a client that by mis-matching itemName and Collection requires the |
@roger-kaybus when you get a chance let me know the status and if you're all set please close the issue. |
its working for me fine right now. I'll close this. |
in basefixtureloader
var fixtureModel = mongoose.model(fixtureItem, fixtureSchema);
so looks like model name is the fixture.itemName.
in mongoosefixture
if(name === item.collection){
collectionExists = true;
}
for deletes
adding seems to use fixture.itemName and remove seems to use the fixture.collection. If I set these two the same, everything works fine. If they are different, the remove code breaks.
The text was updated successfully, but these errors were encountered: