Uploaded image for project: 'Couchbase .NET client library'
  1. Couchbase .NET client library
  2. NCBC-2272

Creating a list with ListAppend fails

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Duplicate
    • 2.7.15
    • 2.7.22
    • library
    • None
    • 1

    Description

      Similar to the issue reported in https://forums.couchbase.com/t/creating-a-list-with-listappend-fails/16988, I am attempting to create a list using ListAppend(keyValue, objectValue, true).  When this occurs I get a success = true back but no list shows up in the Couchbase portal.  If I create the empty list first and then do a ListAppend with a false then the data is added without issue.

      Attachments

        Issue Links

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

          Activity

            jrwallace96 James Wallace added a comment - - edited

            I moved on to Maps and found it was also happening with them as well.  I end up having to do a Bucket.Upsert(key, "{}").

            public override bool DictionaryAdd(string key, string mapKey, object value) { if (string.IsNullOrWhiteSpace(key)) throw new ArgumentNullException(nameof(key), @"The key parameter must be string value with length greater than zero."); if (string.IsNullOrWhiteSpace(key)) throw new ArgumentNullException(nameof(mapKey), @"The mapKey parameter must be string value with length greater than zero."); if (value == null) throw new ArgumentNullException(nameof(value), @"The value object parameter must not be null."); try { IResult result; if (Bucket.MapSize(key).Value == 0) { result = Bucket.Upsert(key, "{}"); if (!result.Success) throw new Exception(); } result = Bucket.MapAdd(key, mapKey, JsonConvert.SerializeObject(value), false); if (result.Success) return true; throw result.Exception; } catch (Exception ex) { //Logger.Error("CouchbaseCacheProvider:MapAdd", ex); return false; } }
            

            jrwallace96 James Wallace added a comment - - edited I moved on to Maps and found it was also happening with them as well.  I end up having to do a Bucket.Upsert(key, "{}"). public override bool DictionaryAdd(string key, string mapKey, object value) { if (string.IsNullOrWhiteSpace(key)) throw new ArgumentNullException(nameof(key), @ "The key parameter must be string value with length greater than zero." ); if (string.IsNullOrWhiteSpace(key)) throw new ArgumentNullException(nameof(mapKey), @ "The mapKey parameter must be string value with length greater than zero." ); if (value == null ) throw new ArgumentNullException(nameof(value), @ "The value object parameter must not be null." ); try { IResult result; if (Bucket.MapSize(key).Value == 0 ) { result = Bucket.Upsert(key, "{}" ); if (!result.Success) throw new Exception(); } result = Bucket.MapAdd(key, mapKey, JsonConvert.SerializeObject(value), false ); if (result.Success) return true ; throw result.Exception; } catch (Exception ex) { //Logger.Error("CouchbaseCacheProvider:MapAdd", ex); return false; } }
            jmorris Jeff Morris added a comment -

            James Wallace -

            Thanks for reporting, I will look into this as soon as possible.

            -Jeff

            jmorris Jeff Morris added a comment - James Wallace - Thanks for reporting, I will look into this as soon as possible. -Jeff

            Thank you

            jrwallace96 James Wallace added a comment - Thank you
            jmorris Jeff Morris added a comment -

            I am pretty sure this is caused by NCBC-2287, which duplicates the fix. Feel free to open this back up if not.

            jmorris Jeff Morris added a comment - I am pretty sure this is caused by NCBC-2287 , which duplicates the fix. Feel free to open this back up if not.

            People

              jmorris Jeff Morris
              jrwallace96 James Wallace
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty