Hi,
I have stored documents in MarkLogic in JSON format, see this example below
:
{
'ecm__id': '00000000-0000-0000-0000-000000000000',
'ecm__racl': [ 'Administrator', 'Members' ],
'dc__modified': '1970-01-01T00:00:00.000'
}
I have two use cases:
- replace-insert an object, for example { "ecm__minorVersion": 0 }
- replace-insert an object with array, for example { "ecm__racl": [
"Administrator", "members" ] }
Currently the two use cases have the same kind of patch request. For
example with the first one, I have this patch operation :
{"pathlang":"xpath",
"patch":[{"replace-insert":{"select":"/node('ecm__minorVersion')",
"context":"/node('ecm__id')", "position":"after",
"content":{"ecm__minorVersion":0}}}]}
Then I get this document :
{
'ecm__id': '00000000-0000-0000-0000-000000000000',
'ecm__minorVersion': 0,
'ecm__racl': [ 'Administrator', 'Members' ],
'dc__modified': '1970-01-01T00:00:00.000'
}
If I re-patch the same document with minor version = 1, I get :
{
'ecm__id': '00000000-0000-0000-0000-000000000000',
'ecm__minorVersion': { 'ecm__minorVersion': 1 },
'ecm__racl': [ 'Administrator', 'Members' ],
'dc__modified': '1970-01-01T00:00:00.000'
}
but I expect to get :
{
'ecm__id': '00000000-0000-0000-0000-000000000000',
'ecm__minorVersion': 1,
'ecm__racl': [ 'Administrator', 'Members' ],
'dc__modified': '1970-01-01T00:00:00.000'
}
How could I patch the document to get the right behaviour ?
I have tried several patch requests, see below a non exhaustive list :
- put a *parent* node at root -> same behaviour
- don't use *node('...')* in select path -> same behaviour for 1. and error
for 2. at the first patch
> *XDMP-CHILDDUPNAME:
> xdmp:node-insert-after(fn:doc("/00000000-0000-0000-0000-000000000000.json")/text("ecm__id"),
> array-node{text{"Administrator"}, text{"members"}}) -- Object nodes cannot
> have two children with the same name .*
- don't use *node('...')* in context path -> same behaviour
Thanks
Kevin Leturc *Software developer*
Twitter @kevinleturc
nuxeo.com <https://www.nuxeo.com>
[image: www.nuxeo.com - Content Management Platform] <http://www.nuxeo.com>
_______________________________________________
General mailing list
[email protected]
Manage your subscription at:
http://developer.marklogic.com/mailman/listinfo/general