Hello @Zil_D
Please review:
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();
I would also look into is whether you’re hitting the connection max limits, if so I would refer to AWS support specifically in determining the solution for the AWS Lambda timeouts and it would be awesome to share them here.
As Lambda timeout is something that is frequently brought up here, I personally haven’t experienced it myself in my AWS lab so I’m not exactly sure what specifically may cause it.
But for Mongoose the above is pretty much what I do for the most part to connect and I use a URI instead of local.