const mongoose = require('Mongoose');
mongoose.connect("MongoDB://localhost:<PortNumberHereDoubleCheckPort>/<DatabaseName>", {useNewUrlParser: true});
const <nameOfDbschemahere> = new mongoose.schema({
name: String,
rating: String,
quantity: Number,
someothervalue: String,
somevalue2: String,
});
const Fruit<Assuming as you call it FruitsDB> = mongoose.model("nameOfCollection" , <nameOfSchemeHere>);
const fruit = new Fruit<Because FruitsDB calling documents Fruit for this>({
name: "Watermelon",
rating: 10,
quantity: 50,
someothervalue: "Pirates love them",
somevalue2: "They are big",
});
fruit.save();
In MongoDB when logged in via terminal:
show dbs
Select the DB in this case whatever you named the database by typing: use databasename
show collections
You should then see the fruits collection.
db.fruits.find will then pull up all documents in fruit.