I have 3 kind of records,
1)Categories,
2)Topics and
3)Articles
In my mongodb, i have only 1 colection named \'categories\' in which i stroe
Try-
mongoose.model('category', CategorySchema, 'categories');
mongoose.model('topics', TopicSchema, 'categories');
mongoose.model('articles', ArticlesSchema, 'categories');
As mentioned in docs: http://mongoosejs.com/docs/api.html#index_Mongoose-model
Mongoose#model(name, [schema], [collection], [skipInit])
Defines a model or retrieves it.
Parameters:
- 1st param - name
model name - 2nd param - [schema]
schema name - 3rd param - [collection]
collection name (optional, induced from model name) - 4th param - [skipInit]
whether to skip initialization (defaults to false)
See - https://stackoverflow.com/a/14454102/3896066