update_one
Update the first MongoDB document matching a filter using operators like $set or $inc. Specify collection, optional database, and upsert to insert if no match.
Instructions
Perbarui DOKUMEN PERTAMA yang cocok dengan filter menggunakan operator update.
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": "update_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. | |
| update | No | Dokumen update MongoDB. Gunakan operator seperti {"$set": {"umur": 31}} atau {"$inc": {"counter": 1}}. Tanpa operator akan otomatis dibungkus "$set". | |
| 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. |