Hi All,
The module docs for db:replace (http://docs.basex.org/wiki/Database_Module#db:replace) states that: "Replaces a document, specified by $path, in the database $db with the content of $input, or adds it as a new document."
However, when I try to run a query using db:replace: return db:replace($database, $jsonXML, $targetProfilePath)
I get the following error regardless of whether there is a document in the db at that path or not: [FODC0002] Resource "/targetProfiles/5321cff2e4b0372d556893f4" does not exist.
db:add() seems to be working fine but I would prefer not to add multiple documents at the same path.
I suppose I can work around this by first using db:delete() to remove any documents at the path and then using db:add() but I would appreciate any insight into why db:replace() isn't working as expected.
Thanks, -Jesse
However, when I try to run a query using db:replace: return db:replace($database, $jsonXML, $targetProfilePath)
You'll probably need to swap the second and third argument; see [1]. I agree it's confusing that the signatures for db:add() and db:replace() differ. This is due to backward compatibility issues, and may be fixed with a future db:update() function that will combine the functionality of both db:add() and db:replace().
[1] http://docs.basex.org/wiki/Database_Module#db:replace
I get the following error regardless of whether there is a document in the db at that path or not: [FODC0002] Resource "/targetProfiles/5321cff2e4b0372d556893f4" does not exist.
db:add() seems to be working fine but I would prefer not to add multiple documents at the same path.
I suppose I can work around this by first using db:delete() to remove any documents at the path and then using db:add() but I would appreciate any insight into why db:replace() isn't working as expected.
Thanks, -Jesse
BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
Ahah! Good catch!
I did not expect the method signatures to be different and just changed the method name in my code when switching from add() to replace().
Thanks, -Jesse
On Mar 17, 2014, at 4:59 PM, Christian Grün christian.gruen@gmail.com wrote:
However, when I try to run a query using db:replace: return db:replace($database, $jsonXML, $targetProfilePath)
You'll probably need to swap the second and third argument; see [1]. I agree it's confusing that the signatures for db:add() and db:replace() differ. This is due to backward compatibility issues, and may be fixed with a future db:update() function that will combine the functionality of both db:add() and db:replace().
[1] http://docs.basex.org/wiki/Database_Module#db:replace
I get the following error regardless of whether there is a document in the db at that path or not: [FODC0002] Resource "/targetProfiles/5321cff2e4b0372d556893f4" does not exist.
db:add() seems to be working fine but I would prefer not to add multiple documents at the same path.
I suppose I can work around this by first using db:delete() to remove any documents at the path and then using db:add() but I would appreciate any insight into why db:replace() isn't working as expected.
Thanks, -Jesse
BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
basex-talk@mailman.uni-konstanz.de