I have a JSON document in DocumentDB.
I wish to add new data to a given document.
For example.
Current document:
{
"User": "ABC",
"UserID": "123"
}
New document
{
"User": "ABC",
"Height":"1.60",
"UserID": "123"
}
I have tried solutions such as mentioned here:
Add new properties to DocumentDB Document in Stored procedure
But I get "getContext is not defined".
I believe the issue is that I am unsure of how to call a document via a function.
I would like:
var documentURL = "dbs/'dbname'/colls/'collsname'/docs/'docsname'"
editDocument(documentURL)
function editDocument(document) {
var collection = getContext().getCollection();
var response = getContext().getResponse();
document.Height = "1.60";
collection.createDocument(collection.getSelfLink(), document, function(err, result) {
if(err) throw err;
// Return the resulting document back as the response.
response.setBody(result);
});
}
Should I use client.replaceDocument instead, or maybe there is a better way to do this.
The issue may be that the function is plainly trying to use the text location "dbs/colls/docs" in the function rather than the document itself.
Thanks for any help in advance!