replace_one
Replaces the entire content of a single MongoDB document matching a filter with a new document. Supports upsert to create a document when no match exists.
Instructions
Ganti seluruh isi satu dokumen yang cocok dengan filter dengan dokumen baru.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"collection": "<collection>"
},
"name": "replace_one"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filter | No | Query filter MongoDB. Contoh: {"status": "aktif", "umur": {"$gt": 25}}. Kirim sebagai objek atau string JSON. Gunakan {} untuk semua dokumen. | |
| upsert | No | Jika true, dokumen baru dibuat bila tidak ada yang cocok dengan filter (default false). | |
| database | No | Nama database tujuan. Opsional jika MONGODB_DB sudah diatur. | |
| collection | Yes | Nama koleksi. | |
| replacement | No | Dokumen pengganti LENGKAP (tanpa operator $). Seluruh isi dokumen lama diganti. |