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

Binary data gets mangled during mutations

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 3.0.4
    • 3.0.3
    • library
    • None
    • 1

    Description

      I’m attempting to insert a buffer of binary data, and it gets mangled by the couchbase driver upon insert. The Admin console shows the data as mangled, and fetching the item again from the bucket using the API shows it as well.
      The following code reproduces the test case on Node v12.15.0 and Ubuntu, using Couchbase 3.0.3. This is a regression. I’ve tested on 2.6.12 and the data is properly preserved.

      var couchbase = require('couchbase');
      var assert = require("assert");
      var mainCluster = new couchbase.Cluster('', { username: '', password: '' })
      var mainBucket = mainCluster.bucket('');
      var mainColl = mainBucket.defaultCollection();
      let valueToInsert = "092bc691fb824300a6871ceddf7090d7092bc691fb824300a6871ceddf7090d7092bc691fb824300a6871ceddf7090d7092bc691fb824300a6871ceddf7090d7092bc691fb824300a6871ceddf7090d7092bc691fb824300a6871ceddf7090d7092bc691fb824300a6871ceddf7090d7092bc691fb824300a6871ceddf7090d774d604487b654d829769af3007a4c0a1092bc691fb824300a6871ceddf7090d774d604487b654d829769af3007a4c0a174d604487b654d829769af3007a4c0a174d604487b654d829769af3007a4c0a174d604487b654d829769af3007a4c0a174d604487b654d829769af3007a4c0a174d604487b654d829769af3007a4c0a1"
      async function main() {
          await mainColl.upsert("test", Buffer.from(valueToInsert, 'hex'));
          let result = await mainColl.get("test")
          assert(valueToInsert == result.value.toString('hex'))
      }
      main()
      

      Attachments

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

        Activity

          People

            brett19 Brett Lawson
            brett19 Brett Lawson
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty