I have tried XQUERY updates that should work but they don't work.
My technique of storing JSON documents is perhaps not traditional.
I have reduced my example to this simple example.

FRIST CREATE DATABASE WITH ONE DOCUMENT:

db:create('geography', json:parse('{ "code": "USA", "name": "United States of America", "birth": 1776 }'), '/country')

THEN ADD ANOTHER DOCUMENT:

db:add('geography', json:parse('{ "code": "CAN", "name": "Canada", "birth": 1867 }'), '/country')

  1. How can I update either of these documents using 'code' as the unique identifier?
    1. How can I change the 'name' or 'birth'?
    2. How can I add a 'population' number?
  2. How can I delete either of these documents using 'code' as the unique identifier?