Couchbase .NET Client Library 2.0. - Performance Issues
One thing I have noticed is that the .NET Couchbase Client API does not correctly filter the results in Couchbase, but sends back the entire result set of the views (select * from view). On the client the filter is then applied to the whole set of data. This is horrific in terms of performance.
What is the plan for the client? As of now, the only usable features are the Membase functionality.
*This was originally posted on the SDKs forum: http://www.couchbase.org/forums/thread/couchbase-net-client-query-genera...
John - Thanks for the tip and the explanation (which make sense).
CouchbaseNetClient 1.0.1 does not have method GetView(designName, viewName) which is available in 0.9.2
and
CouchbaseNetClient 0.9.2 does not have fluent methods like StartKey(""), EndKey("") etc..
What client library should I/ can I use to try your solution.
Yes, the current release that you'll find on Nuget does not have GetView. The reason that method isn't available is that the 1.0 client supports the 1.8 server, which does not have view functionality. The StartKey and EndKey fluent methods are chained off of the view, so they won't be on the client, but the View returned by client.GetView. Are you not seeing those with 0.9.2?
I was trying with 0.9.1 and it was not available. I see it in the 0.9.2 library. Thanks
You mention that 1.8 server(and i am guessing even 2.0) does not have view functionality. Is there a reason for that, and how would you recommend we change our approach then. Our current approach with Couchbase involves writing a lot of views with different Map functions.
We have just started to look into using Couchbase at our company and would like to target the latest server.If you could point me at some resources, I will really appreciate that.
Views are not part of 1.8, but they'll definitely be back in 2.0. Couchbase Server 2.0 Developer Preview 3 is available for download at http://www.couchbase.com/download.
Over the next few weeks, I'll be working to put nightly builds online and that will sooner than later include the 2.0 client functionality.
Wonderful. Thank you so much for all your help.
Hi John,
using DonNet driver 1.0.0 (downloaded from CB 2 Dev-Preview 3 page). File descriptions says "none 1.0-yet" (GetView method is included). I guess its version 0.9.1.
I try to reproduce your sample with fluent methods.
The rest api call for querying a view
http://x:8092/default/_design/query/_view/muc2?startkey=%2280331%22&endk...
is working well, but the following code response with all keys within the view:
using (CouchbaseClient client = new CouchbaseClient(cconfig))
{
var view = client.GetView("query", "muc2").StartKey("80331").EndKey("80339");
var munich = view.ToList();
foreach (var muc in view)
Console.WriteLine("{0}", muc.ViewKey);
}
Do i miss a link? Has anyone a suggestion for me.. thanks in advance.
Issue closed.
Hi .net guys,
the DotNet driver you can download at www.couchbase.com -> Develop seems to be an outdated version. Downloading the sources from github https://github.com/couchbase/couchbase-net-client and buidling them sloved my issues.
Happy coding;)
Hi Tom,
That's correct, the latest code on Github does support our view API. You can also get binaries at http://www.couchbase.com/develop/net/next. I'll be updating the documentation here shortly, so stay tuned for more complete samples and API docs. Also, there will be bug fixes and improvements coming to the client as we prepare for a 2.0 server launch.
-- John
Hi,
Currently, the focus is to get the Couchbase Client ready for the 1.8 release, which is coming this January. After that, I'll be pushing forward with improvements to the core 1.8 functionality as well as making sure CBS 2.0 support is solid.
In the meantime, something you might want to try in your code is something like the following:
var client = new CouchbaseClient(); var query = client.GetView("content", "articles") .StartKey("clp test") .Select(a => (string) a.GetItem()) .Select(x => JsonUtility.Deserialize<Article>(x));Note the addition of .StartKey("clp test") instead of the LINQ Where.
I haven't had a chance to test this code, so my apologies if it's not quite right.
To modify the query before it's sent to the server, you need to use the fluent methods (i.e., StartKey, EndKey, Skip, etc.). These methods are chainable and should properly modify the query as you'd expect. So you could have something like:
client.GetView("content", "articles").StartKey("a").EndKey("f").Limit(10);There's not actually an IQueryable implementation in the current client, so calling .Where and .Select doesn't modify the query, only the results.
-- John