I should add that the projects I mentioned are community projects, and not supported by MarkLogic. The GitHub issues of each project is the best place for these discussions.
Thanks. -jb Sent from my iPhone On May 8, 2015, at 10:59 AM, Joe Bryan <[email protected]<mailto:[email protected]>> wrote: Hi Yinyan, The MLRest service in the slush-marklogic-node generator (https://github.com/marklogic/slush-marklogic-node) is from this project: https://github.com/joemfb/ml-common-ng. I intend to publish docs for the project, and will update this thread when I do. mlRest.updateDocument() takes two parameters, the document contents, and the URL params of the request. For instance: mlRest.updateDocument({ contents: 'hello world' }, { uri: '/hello-world.json' }) As for your error message, that's coming from the middleware layer in server.js. The route proxying function for REST API PUT requests is expecting to always have a "uri" URL param, which is failing when you call mlRest.createDocument(). Can you open a new ticket on slush-marklogic-node? Thanks. -jb From: Yinyan guy <[email protected]<mailto:[email protected]>> Reply-To: MarkLogic Developer Discussion <[email protected]<mailto:[email protected]>> Date: Friday, May 8, 2015 at 9:39 AM To: "[email protected]<mailto:[email protected]>" <[email protected]<mailto:[email protected]>> Subject: [MarkLogic Dev General] updating a JSON document from AngularJS app Hi All, I am working on a Angularjs application and I need help on updating the JSON document. I am using ML8 and have used slush marklogic-node to create the application framework. I am trying to update the JSON document and I need more information on mlrest.updateDocument(). In my Controller file following is the code I have written in submit button press function. submit: function() { mlRest.updateDocument($scope.model, { format: 'json', directory: '/car/', extension: '.json' // TODO: add read/update permissions here like this: // 'perm:sample-role': 'read', // 'perm:sample-role': 'update' }).then(function(response) { win.location.href = '/detail?uri=' + response.headers('location').replace(/(.*\?uri=)/, ''); }); } // I was not able to find any information on using mlRest.updateDocument, hence I used code for create document (I have commented most of the code) and I am also not sure where do I pass the uri of the document to be updated. On running the above code I got the following error TypeError: Cannot read property 'match' of undefined at /Users/pmakwana/MyWork/carsearch/server.js:176:20 at Layer.handle [as handle_request] (/Users/pmakwana/MyWork/carsearch/node_modules/express/lib/router/layer.js:82:5) at next (/Users/pmakwana/MyWork/carsearch/node_modules/express/lib/router/route.js:110:13) at Route.dispatch (/Users/pmakwana/MyWork/carsearch/node_modules/express/lib/router/route.js:91:3) at Layer.handle [as handle_request] (/Users/pmakwana/MyWork/carsearch/node_modules/express/lib/router/layer.js:82:5) at /Users/pmakwana/MyWork/carsearch/node_modules/express/lib/router/index.js:267:22 at Function.proto.process_params (/Users/pmakwana/MyWork/carsearch/node_modules/express/lib/router/index.js:321:12) at next (/Users/pmakwana/MyWork/carsearch/node_modules/express/lib/router/index.js:261:10) at urlencodedParser (/Users/pmakwana/MyWork/carsearch/node_modules/body-parser/lib/types/urlencoded.js:77:44) at Layer.handle [as handle_request] (/Users/pmakwana/MyWork/carsearch/node_modules/express/lib/router/layer.js:82:5) Does any one have the sample code to update the document? Is there any documentation available on mlRest.updateDocument()? Thanks in advance. regards, Puneet _______________________________________________ General mailing list [email protected]<mailto:[email protected]> Manage your subscription at: http://developer.marklogic.com/mailman/listinfo/general
_______________________________________________ General mailing list [email protected] Manage your subscription at: http://developer.marklogic.com/mailman/listinfo/general
