create function mongoose code example
Example 1: model mongoose
const modelName = mongoose.model("collectionname", collectionSchema);
//example
const fruitSchma = new mongoose.Schema ({
name: String
});
const Fruit = mongoose.model("Fruit", fruitSchema);
Example 2: mongoose modele
mongoose.connect('mongodb://localhost/gettingstarted', {useNewUrlParser: true,useUnifiedTopology: true});