Closed genxlogics closed 7 years ago
Hi @genxlogics
PATCH is the verb to use to perform a partial update
However with your second request you are patching the collection resource (identified by the URI /transactional/tempreq). Note that RESTHeart manages properties for dbs and collections (have a look at this documentation page for a quick reference).
To patch your document
PATCH /transactional/tempreq/1
{
"prop1":"val111",
"prop2":"val211"
}
If the _id is a number, you need to pass the id_type query parameter (not needed for strings and ObjectId types)
PATCH /transactional/tempreq/1?id_type=number
the $set
operator is optional. For instance the following request sets a
and b
and unsets c
PATCH /transactional/tempreq/1
{
"a":1,
"b":2,
"$unset": {"c: ""}
}
Hi @genxlogics Did you solve your issue? I'm closing this now, feel free to re-open in case.
@ujibang , i am trying to set the multiple properties of a document through POST as below
POST /transactional/tempreq { "_id":"1" "$set":{"prop1":"val111","prop2":"val211"} }
what it is doing is that it removes all other existing properties of the document. so no new document has only two properties.
when i use PATCH it just updates something else at i dont know where
PATCH /transactional/tempreq { { "_id":"1", "$set":{"prop1":"val111","prop2":"val211"} } }
i need to update multiple properties and keep other things intact. please help !!