Error on dotnet6.0 with couchbase 3.2 sdk

Hi Everyone. I’ve got an error when trying to follow the documentation for appending an object to the array on a document.
Here is the code:

collection.MutateInAsync(userId, specs => specs.ArrayAppend("playerGoalList", new [] {123}));

This is the error appearing on the specs.ArrayAppend:

Cannot convert lambda expression to type ‘IEnumerable’ because it is not a delegate type

Any help would be greatly appreciated!

I believe you are getting that as a compiler error because you are missing a namespace import. Add a using Couchbase.KeyValue; statement to the top of your file. This will give you access to the extension method you’re trying to use.


Brilliant, been racking my brain all day through the docs. That solved it, thank you!

Out of curiosity, what IDE are you using? I use VS with Resharper and it lets me know and suggests the missing namespace import. I’m pretty sure plain VS and Rider do the same. I’m wondering why you didn’t get the suggestion and if we may need to tweak the docs because of that.

I’m using VS Code 1.66.2 with extension: C# for Visual Studio Code (powered by OmniSharp) v1.24.4 .