Skip to content

DatabaseClient.eval() always return true when the result is a boolean #669

Closed
@fgeorges

Description

@fgeorges

When evaluating a piece of JavaScript on the server using DatabaseClient.eval() seems to always return true when the expression results in a single boolean. Even when the result is false.

To reproduce:

require('marklogic')
    .createDatabaseClient({
        host:     'localhost',
        port:     '8000',
        database: 'neo-elec-content',
        user:     'admin',
        password: 'admin',
        authType: 'DIGEST'
    })
    .eval(`false;`)
    .result()
    .then(res => console.dir(res));

returns the following:

[ { format: 'text', datatype: 'boolean', value: true } ]

We would expect of course value to be false. If you change the expression in the eval() to, say, '42;', then you get the correct result:

[ { format: 'text', datatype: 'integer', value: 42 } ]

I use the marklogic package version 2.9.0 (installed last week with npm i marklogic.)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions