MongoDB creates duplicate document everytime hit Save?

I noticed everytime I hit Save in my VSCode, even though newUrl is unchanged, a new document is updated to MongoDB, with a new _id.

Is this behavior normal? Is it by default? Can I change it?

My code is like this:

const express = require("express");
const app = express();
const cors = require("cors");
const mongoose = require("mongoose");
const {Schema, model} = mongoose;

mongoose.connect(process.env.MONGO_URI, {useNewUrlParser: true, useUnifiedTopology: true});

const urlSchema = new Schema({
	original_url: {
		type: String,
		required: true,
	short_url: Number,
const Url = model("url", urlSchema);

// unchanged
let newUrl = new Url({
	original_url: "",
	short_url: 1,
});, data) => {
	if (err) console.error(err);

app.get("/", (req, res) => {

If something happens every time you save the document, then I would assume you are using nodemon. However, regardless if you were just using node to start the app, your current code will continue to create the same record with original_url containing and short_url containing 1 each with a new _id because that is what you have written your code to do every time the app runs (or reruns).