Linq2Couchbase not working in .NET SDK 2.3.9

We recently updated from 2.3.8 to 2.3.9 and are having trouble getting results with LINQ queries, but N1QL is still working. Previously, we were able to do the following query with Linq:

var query = (from r in bucket.Query<Recording>() where r.Type == "recording" select r);

However, now with the cluster level query if I try the following the compiler does not recognise the syntax:

var query = (from r in cluster.Query<Recording>() where r.Type == "recording" select r);

and the “where” comes up in red.

Did the Linq2Couchbase API break in 2.3.9?

Any thoughts on this?

Hello, is there any body out there?

Yes, definitely-- I pinged @jmorris on it just a couple minutes ago.

By the way, does it still work at the bucket level?

It gives the same sort of error, also says that the bucket.query is obsolete, and I should use cluster.query

@tura1990 -

I am a little confused; the code you show here is the SDK not Linq2Couchbase! Linq2Couchbase uses a BucketContext, which implements IQueryable which allows you to create your Linq expression:

using(var bucket = cluster.OpenBucket("travel-sample"))
{
    var context = new BucketContext(bucket);

    var query = (from r in context.Query<Recording>() where r.Type == "recording" select r);

    foreach(var r in query)
    {
         Console.WriteLine(r.ToString());
    }
}

The IBucket and ICluster implementations have Query methods, but they return an IQueryRequest impl which does not implement IQueryable, therefore does not support Linq.

Perhaps there is a little confusion regarding which API implements IQueryable?

-Jeff

@tura1990 -

Rest assured, the query is support by both ICluster and IBucket; the ObsoleteAttribute was removed for v2.3.10 to be released next week.

-Jeff

This is what it looks like on my system.

@tura1990 -

Using NuGet, make sure you have a dependency on Linq2Couchbase which will bring in the Couchbase.NET SDK dependency. The error message indicates you are not referencing the SDK (Couchbase.NetClient) - I think if you make sure the Linq2Couchbase dependency is correct, you should be good.

-Jeff

@tura1990 -

I think you may be encountering this issue: Linq2Couchbase doesn't work with Couchbase.NetClient 2.3.9 · Issue #169 · couchbaselabs/Linq2Couchbase · GitHub

The work-around is to change the Couchbase SDK dependency to 2.3.8. Note that this will be fixed in v2.3.10!

-Jeff

I believe I have the correct and latest versions.

@tura1990 -

Change the Couchbase.NetClient dependency to 2.3.8 using the NuGet package manager; there is a bug with 2.3.9 that makes the version incompatible with Linq2Couchbase.

Sorry for the confusion!

-Jeff

Ok, so there was a break/bug in 2.3.9. Will this be resolved in 2.3.10? Probably worth creating a ticket as well so others will know of the issue. Thanks.

@tura1990 -

Yes, it is a packaging bug. The ticket is here: Loading...

-Jeff