I just started working with Couchbase, using Couchbase SDK 2.0. I can successfully save and query documents, using Bucket.Upsert and Bucket.Query<obj>.
However, I’m completely unable to figure out how to get a strong typed, deserialized POCO from Bucket.Query. So, what I want to do is Bucket.Query<Team>, and get a List<Team> back.
I’ve gone through all the examples, and they either use CouchbaseClient, which I’m unable to locate, or they use Query<dynamic>, which doesn’t work nicely with F#…
Any advice or pointers would be greatly appreciated.
Are you referring to a View or N1Ql query? With views there is some additional work that needs to be done because the record returned by the view engine doesn’t match perfectly: it’s encapsulated in a view row. This will be changing soon.
Just like to add. It would be great if Couchbase can add a clear example like this somewhere. I found it a bit confusing that the example apps use Query<dynamic> (like the beer brewery) and didn’t really explain how to deserialize a strong typed object.
Glad to hear you got this resolved and thanks for the feedback! I will be updating the docs and sample apps in the next couple of weeks and will make the suggestions you mentioned.