You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{
"_id": "5f731c9171320635dc9c126c",
"name": "Kragerø Grand Prix 2020",
"description": "Kragerø Sjakklubb inviterer nok en gang til Kragerø GP. Dette for tiende gang! Det er satt en grense på 100 spillere, så meld deg på før det er for sent!",
"place": "Kragerø Sportell",
"group": "Individuell turnering",
"time": "90 minutter + 30 sekunder pr. trekk",
"date": "14. - 17. okt 20",
"organizer": "Kragerø Sjakklubb",
"arbiter": "FA Hans Jørgen Hoem",
"price": "550 kr for FIDE under 2150. IM/GM gratis samt WFM.",
"players": [
"Hans Asbjørn"
]
}
When I call .update() like this: const updated = await tournaments.update( { _id: id }, { $set: value }, { overwrite: true }, );
where value is:
{
"name": "Kragerø Grand Prix 2020",
"description": "Kragerø Sjakklubb inviterer nok en gang til Kragerø GP. Dette for tiende gang! Det er satt en grense på 100 spillere, så meld deg på før det er for sent!",
"time": "90 minutter + 30 sekunder pr. trekk",
"group": "Individuell turnering",
"place": "Kragerø Sportell",
"date": "14. - 17. okt 20",
"organizer": "Kragerø Sjakklubb",
"arbiter": "FA Hans Jørgen Hoem",
"price": "550 kr for FIDE under 2150. IM/GM gratis samt WFM."
}
notice that the "players" array is deleted.
But, when I try to update my database on that document with the specific ID, it doesn't remove the players object. How can I just overwrite the document but keep the same ID?
The text was updated successfully, but these errors were encountered:
bastianpedersen
changed the title
.update not updating correctly
.update() not updating correctly. How can I overwrite but keep same ID?
Sep 30, 2020
Database contains:
When I call .update() like this:
const updated = await tournaments.update( { _id: id }, { $set: value }, { overwrite: true }, );
where value is:
notice that the "players" array is deleted.
But, when I try to update my database on that document with the specific ID, it doesn't remove the players object. How can I just overwrite the document but keep the same ID?
The text was updated successfully, but these errors were encountered: