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

SDK should have expose subdoc functions for adding multiple items to collections

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 2.4.4
    • None
    • None
    • None

    Description

      https://github.com/couchbaselabs/sdk-rfcs/blob/master/rfc/0002-subdocapi.md#multi-value-array-operations

      SDKs must implement a way to submit multiple values so that they are encoded in such a manner

      So that I would expect the following code result in {"hits":[1,2,3,4,5]}, but currently arrayAppendAll does not exist

      var couchbase = require("couchbase");
        
      var cluster = new couchbase.Cluster('couchbase://localhost');
      cluster.authenticate('Administrator', 'password');
       
      var bucket = cluster.openBucket('default');
      bucket.upsert('foo', {'hits': [1, 2, 3]},
        function (err, res) {
          if (!err) {
            bucket.mutateIn('foo').arrayAppendAll('hits', [4, 5])
              .execute(function(err, res) {
                if (err) {
                  console.log("error: ", err);
                  process.exit();
                }
                bucket.get('foo', function (err, res) {
                  if (err) {
                    console.log("error: ", err);
                  } else {
                    console.log("value: %j", res);
                  }
                  process.exit();
                });
              });
          }
        }
      );
      

      See also: https://forums.couchbase.com/t/arrayappend-in-node-sdk-multiple-addition/14808

      Attachments

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

        Activity

          People

            brett19 Brett Lawson
            avsej Sergey Avseyev
            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