Creating a list with ListAppend fails

If I try and create a list using ListAppend I get a KeyNotFound status in the result, even if the third parameter is true.

bucket.ListAppend("list", "value", true);

The same appears to be true for equivalent methods for sets and maps.

I can create lists, sets and maps using Insert without any problem.

bucket.Insert("list", "[]");
bucket.ListAppend("list", "value", false);

Am I missing something, or is this functionality broken?

1 Like

Hi @mark_watts

Thanks for the bug report. It does indeed seem like a bug in the SDK. Internally we use the subdoc API to perform the actions and instead of the bool being used to create the document if it doesn’t exist, it’s used to create the array within the document if missing.

I’ve created ticket NCBC-1694 to track and fix.

1 Like

Thanks @MikeGoldsmith, I’ll use the two-step workaround until the next version of the SDK is out.

1 Like

Has this issue ever been resolved? I am running into the same problem with version 2.7.15. The insert works when creating the list first.

It looks like NCBC-1694 was resolved back in 2018. If you’re seeing the same behavior, it could be a regression. I’d suggest creating a ticket at with your repro steps, version information, etc. I’ll also tag @jmorris here for awareness purposes; he may have some additional insight.

Thank you @matthew.groves.