Document keeps duplicating every time i read the document

hey, I’m pretty new to MongoDB. So whenever I’m getting a document it keeps duplicating any idea why

const serverInfoSchema = new Schema ({
    name  : String,
    uid : number,
    serverIcon : String,
    owner : number,
    region : String,
    membersNumber : number,
    members : Array,
    roles : Array,
    channel : Array,
    region : String
})
const serverInfoModel = mongoose.model('server-info', serverInfoSchema);

Hi there!

That’s an odd issue. Let’s see if we can get to the bottom of it. Can you tell me a little more about what is being duplicated? In your code do you call any functions that create a document? Does it happen only when you start up the server or every time you hit a specific endpoint?

If you have a GitHub repo you can share, that would also help :slight_smile:

3 Likes

edited:

hey, I was just going through all my files and found a function that is causing this. My code was a mess as I rushed to finish it so didn’t see that. sorry inconvenience

2 Likes

Sounds good! Yeah I’ve been there many many times. Good luck with your project :slight_smile:

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.