ExistsAsync / GetAsync Failure

Thanks, @blimkemann, I can’t quite try that code as-is, mainly because I’m not sure what’s behind Database, Database.Current, etc. Also, there’s a Bucket (property, I’m assuming), but also a bucket local variable (which is ignored?). There are some other issues too, like your code defining options but using serverOptions instead in ConnectAsync. Finally, there’s a reference to user.Id, but I don’t see a user object anywhere in your code.

So, below is my attempt at a reproduction. I also created a single document with an ID of User~8169d289-4f47-4973-ac2f-cd6e62698eb9 in a bucket called ‘Core’ and a single primary index on that bucket. In my example, ExistsAsync and GetAsync return true and the correct result, respectively. I suspect, therefore, that there is some mix-up in which bucket is being used for which operation, and/or whatever is in the user.Id field in your code. Take a look at my code and let me know where you think we might differ:

        var settings = new JsonSerializerSettings
        {
            ContractResolver = new DefaultContractResolver(),
            PreserveReferencesHandling = PreserveReferencesHandling.Objects
        };

        var BucketName = "Core";
        var serverOptions = new ClusterOptions
        {
            ConnectionString = $"couchbase://localhost",
            Compression = true,
            UserName = "Administrator",
            Password = "password",
            Serializer = new DefaultSerializer(settings, settings)
        };
        var theCluster = await Cluster.ConnectAsync(serverOptions).ConfigureAwait(false);
        theCluster.ConfigureAwait(false);
        await theCluster.WaitUntilReadyAsync(TimeSpan.FromSeconds(1)).ConfigureAwait(false);
        var bucket = await theCluster.BucketAsync(BucketName).ConfigureAwait(false);
        bucket.ConfigureAwait(false);

        var collection = bucket.DefaultCollection();
        var result = await theCluster.QueryAsync<dynamic>("SELECT meta().id, * FROM Core WHERE meta().id = 'User~8169d289-4f47-4973-ac2f-cd6e62698eb9'");
        var rows = await result.Rows.ToArrayAsync(); // has one row with all of the right information

        var userId = "User~8169d289-4f47-4973-ac2f-cd6e62698eb9";
        var userExists = await collection.ExistsAsync(userId); // userExists.Exists==false
        var userResult = await collection.GetAsync(userId).ConfigureAwait(false); // throws not found exception

        var user = userResult.ContentAs<dynamic>();

        await theCluster.DisposeAsync();