MongooseError: Operation `users.insertOne()` buffering timed out after 10000ms at Timeout. Error?

const mongoose = require("mongoose")

mongoose.connect("mongodb://localhost:27017/testdb")

const userSchema = new mongoose.Schema({
    name : String,
    age : Number
})

const User = mongoose.model("User", userSchema);

const user1 = new User({name: "Jack", age: 24});
user1.save().then(() => console.log("User Saved"));

I was trying to perform CRUD operations on mongoDB database using mongoose and this error popped up.