-
Notifications
You must be signed in to change notification settings - Fork 0
[API] PUT_BY_ID
Replace a document by his {id} in the collection in URL with the body workload of the http request. This workload should contain a valid JSON object. Query the {collection name} in mongo, to find the document with the _id filed equas to the {id} in query parameter. Beware that in case of an update, the object is replaced entirely and the usage of MongoDB’s $modifiers is not permitted. The matching document is return as a JSON string in body workload.
Parameter | Type | Mandatory | Comment |
---|---|---|---|
{database} |
url |
yes |
database name |
{collection} |
url |
yes |
collection name |
{id} |
url |
yes |
id of document |
body |
body |
no |
Content of new document. If it _id field is set, ti has to be with the same value as id provided in url. |
query |
header |
yes if no body provided |
TODO |
writeConcern |
header |
no |
Write concern to use. Possible values : NONE, NORMAL, SAFE, JOURNALED, FSYNC_SAFE, REPLICA_SAFE |
curl -X PUT -d "{'_id' : '1', 'name' : 'Thibaut PINOT'} http://127.0.0.1:8080/kupra/rest/db/col/
{
serverUsed: "127.0.0.1:27017",
ok: 1,
n: 1,
updatedExisting: true
}