Skip to content

SQL Reference

REPLACEONE

db.collection.replaceOne(filter, replacement, options)

Section titled “db.collection.replaceOne(filter, replacement, options)”
  • filter: The selection filter for the document to replace.
  • replacement: The document that replaces the matched one; it must not use update operators.
  • options: Optional settings such as upsert.
db.users.replaceOne({ _id: 1 }, { name: "Ada", age: 37 })