I have tried many ways of updating JSON objects and none seem to work. Using the BaseX GUI, the Result window seems to show the correct outcom, but the database is not modified. What am I missing? Do I need to explicitly start/stop a transaction?
XQUERY: db:open('db','country')/json[countryId = 1] update { replace value of node countryName with 'Aldorria', insert node <population type="number">1000</population> into . }
Result: <json type="object"> <countryId type="number">1</countryId > <countryName>Aldorria</countryName> <population type="number">1234</population> <planetName>Zeldon</planetName> </json>