Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

151
Views
I can't edit the object on mongo database

So i am trying to check if the user has the object with id: 1 after that i try to edit values of this object but it doesn't edit it!

I tried to console.log(quest) and it logged the quest object

       let data;
        try{
            data = await schema.findOne({
                userID: message.author.id
            })
            if(!data) {
            data = await schema.create({
                userID: message.author.id
            })
            }
        } catch(err) {
            console.log(err)
        }

        const quest = data.progress.quests.find(x => x.id == 1)
        quest.current++
        await data.save()

This is how quests array looks in the database

[
    {
        "name": "Say Hi in chat",
        "progress": 5,
        "current": 0,
        "id": 1,
        "reward": 500
    },
    {
        "name": "Play video games",
        "progress": 10,
        "current": 0,
        "id": 2,
        "reward": 250
    },
    {
        "name": "Walk for a time",
        "progress": 5,
        "current": 0,
        "id": 3,
        "reward": 250
    }
]
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!