Uploaded image for project: 'Couchbase node.js Client Library'
  1. Couchbase node.js Client Library
  2. JSCBC-1089

ReadOnly query operation doesn't work

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Major
    • 4.x
    • 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)

       

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            brett19 Brett Lawson
            arun.vijayraghavan Arun Vijayraghavan (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty