Hi,

I am sure I am missing something simple here...  I am trying to add an
object node to a JSON doc stored in the database using JavaScript.
But all examples and documentation I can find are about either JavaScript
manipulating XML nodes, or XQuery manipulating JSON documents.

Especially, in XQuery, one can use object-node {} to construct an object
node.  Which in turn can be used with e.g. xdmp:node-insert-child().
But if I try the following in JavaScript:

    xdmp.nodeInsertChild(
        fn.doc(uri).next().value.root.foo,
        { three: [ 'tres', 3, 'trois' ] });

then I get the following error:

    [javascript] XDMP-CHILDUNNAMED: xdmp.nodeInsertChild(
        fn.head(xdmp.unpath("fn:doc('...')/foo")),
            {"three":["tres", 3, "trois"]})
        -- Object nodes cannot have unnamed children

Any idea what (quite obvious I presume) I am missing?

Regards,

-- 
Florent Georges
http://fgeorges.org/
http://h2oconsulting.be/
_______________________________________________
General mailing list
[email protected]
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to