Open phex85 opened 7 years ago
Hi,
I'm trying to get slugs for subdocs to work but I get an error, what I currently have is:
import mongoose from 'mongoose'; import URLSlugs from 'mongoose-url-slugs' const Schema = mongoose.Schema; const subTypeSchema = new Schema({ name: {type: 'String', required: false}, }); subTypeSchema.plugin(URLSlugs('name')); const productSchema = new Schema({ name: { type: 'String', required: true }, subtypes: [subTypeSchema], }); productSchema.plugin(URLSlugs('name')); export default mongoose.model('Product', productSchema);
I get the following error:
node_modules/mongoose-url-slugs/index.js:161 model.find(q, fields).exec(function(e, docs) {TypeError: : model.find is not a function
What am I doing wrong?
Node version 7.6.0 MongoDB shell version v3.4.4 Mongoose version ^4.4.20
Please submit a reproduction, you seem to be using ES6 syntax.
Hi,
I'm trying to get slugs for subdocs to work but I get an error, what I currently have is:
I get the following error:
What am I doing wrong?
Node version 7.6.0 MongoDB shell version v3.4.4 Mongoose version ^4.4.20