These are chat archives for Automattic/mongoose

Sep 2017
Vineet Dev
Sep 14 2017 07:29
Hi, I am new to mongoose and learning mongo Db. I need to know if I can create two different models to same collection with different schemas?
Scott Gilroy
Sep 14 2017 17:45
@devin6391 I believe you could use the collection parameter of the mongoose.model() method to create multiple models using the same collection. However, this this not typical and probably not recommended as it would be easy to corrupt your data or create various runtime problems if you do this.
mongoose.model('Actor', new Schema({ name: String, role: String }), 'people');
mongoose.model('Director', new Schema({ name: String, assistant: String }), 'people');