Skip to content

Setting optimistic locking throws XDMP-UPDATEFUNCTIONFROMQUERY: #201

Closed
@csreddy

Description

@csreddy

Not sure what I'm doing wrong. Here's what my code looks like:

'use strict';

var fs = require('fs');
var flash = require('connect-flash');
var marklogic = require('marklogic');
var conn = require('../../config/db-config.js').connection;
var db = marklogic.createDatabaseClient(conn);
var q = marklogic.queryBuilder;
var p = marklogic.patchBuilder;
var async = require('async');
var request = require('request');
var _ = require('lodash');
var common = require('../common/common.controller');
var Notify = require('../../email/email').Notify;

var notify = new Notify();

// enable optimistic locking, with version-optional
// this is required to maintain integrity of nextid document
db.config.serverprops.write({
    'update-policy': 'version-optional'
})
    .result(function(response) {
        console.log('setting optimistic locking....');
        console.log(JSON.stringify(response));
    }).catch(function(error) {
        console.log('OPTMISTIC LOCK ERROR', error);
    });


// Get list of items
exports.index = function(req, res) {
    res.send([]);
};
...
...
...

error:

OPTMISTIC LOCK ERROR { [Error: write REST server properties: cannot process response with 500 status]
  message: 'write REST server properties: cannot process response with 500 status',
  statusCode: 500,
  body:
   { errorResponse:
      { statusCode: 500,
        status: 'Internal Server Error',
        messageCode: 'INTERNAL ERROR',
        message: 'XDMP-UPDATEFUNCTIONFROMQUERY: xdmp:apply(function() as item()*) -- Cannot apply an update function from a query . See the MarkLogic server error log for further detail.' } } }

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions