Search code examples
c#.netxamarincouchbase-lite

Couchbase Lite: Cannot access internal constructor "Document" here


I'm trying to use Couchbase Lite 2.0 (Developer preview #21) in a Xamarin.Forms application. My code sharing project is a .NET Standard 2.0 application.

So I'm following the docs about this developer preview. My problem is when I try to create a new Document object. At this point the IDE is saying that I Cannot access the internal constructor "Document" here.

var db = new Database("test");
var document = new Document(); // error raised in this line

But this is the way that the docs indicates to create a new Document object. What I'm doing wrong?

Thanks.


Solution

  • From an question on Couchbase Forum:

    The API changed a few DBs back to switch to an immutable first paradigm. So now things have a “Mutable” counterpart that you can mutate. In this case the class you want is MutableDocument. For what it’s worth this is all mentioned in the release notes. If the release notes are hard to find, though, then that is another story.

    That is:

    When using Couchbase Lite 2.0 you should instantiate a MutableDocument instead of Document.