Updating JSON in XQuery and Marklogic 8
When you only need to insert a property, you first have to wrap the property/value in an object-node
, then select the property child:
xdmp:node-insert-child( doc('/mydoc.json')/node(), object-node { "date": "2016-01-01" }/date)