Details
-
Bug
-
Resolution: Unresolved
-
Major
-
4.1.0, 4.1.1
-
None
-
None
-
1
Description
Based on a forum post request an investigation was done to learn the behavior of readOnly:true when passed in as a query option.
An insert operation was performed passing in a readOnly flag
Expected Behavior : Return an error message just like the one returned by the HTTP endpoint i.e "Request is read-only, cannot perform a write operation"
Observed Behavior : " A document is created and no response is sent back to the user"
Code :
const couchbase = require('couchbase') |
async function main() { const clusterConnStr = 'couchbase://localhost' |
const username = 'Administrator' |
const password = 'password' |
const bucketName = 'travel-sample' |
const cluster = await couchbase.connect(clusterConnStr, { username:username, password:password }) |
|
const query = ` INSERT INTO \`travel-sample\`.inventory.hotel (KEY, VALUE) VALUES ("key_not_insert", { "type" : "hotel", "name": "new hotel"}) ` |
const options = {readOnly:true, metrics:true} |
|
let results = await cluster.query(query, options)
|
|
console.log('Query Results:') |
results.rows.forEach((row) => { console.log(row) }) }
|
main()
|
.catch((err) => |
{ console.log('ERR:', err) |
process.exit(1) }) |
.then(process.exit)
|