Hi, Puneet:

There is no mlrest.updateDocument() in the MarkLogic Node.js API:

Please see:

    https://developer.marklogic.com/products/node
    http://docs.marklogic.com/guide/node-dev/intro
    http://docs.marklogic.com/jsdoc/index.html
    
https://github.com/marklogic/node-client-api/blob/master/examples/write-remove.js#L21


Hoping that helps,


Erik Hennum

________________________________
From: [email protected] 
[[email protected]] on behalf of Yinyan guy 
[[email protected]]
Sent: Friday, May 08, 2015 6:39 AM
To: [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]
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to