Today we're releasing version 2.3.9 of the Couchbase .NET SDK. In this release we have a mixture of new features and bug fixes; including Data Structure API, Cluster Level Authentication and Cluster Level Query support. Also, in case you missed it, we have a Developer Preview of .NET Core support here.
New Features and Changes
We follow semantic versioning, meaning we increment the dot-minor number when adding features. We add low-risk features in maintenance releases with uncommitted interface stability so you as a developer can easily gain access to new features. The features mentioned here are all uncommitted, but should be promoted to committed in the next dot-minor release. See here for a discussion of interface in the .NET SDK.
Data Structure API
Many developers utilise common data structures such as sets and lists in their applications and need to store and retrieve them regularly. We have added Couchbase backed JSON structures to make this process easier where changes in state are automatically persisted into the server.
The data types we have added support for are:
- Set
- List
- Dictionary
- Queue
A more complete introduction of the new Data Structure API will be available in another blog soon.
Cluster Level Authentication
Up until now authentication has been handled in the SDK at the bucket level. This meant that the bucket password was supplied when executing the GetBucket method against the bucket. With the introduction of Cluster Level Queries and more advanced forms of security coming in future releases of Couchbase Server, an improved mechanism is needed.
Cluster Level Authentication enables you to configure the authentication for each bucket directly in the cluster object where it is cached and reused efficiently. An example of setting up the credentials when building the cluster object is below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
var credentials = new ClusterCredentials { ClusterUsername = "Administrator", ClusterPassword = "secret", BucketCredentials = new Dictionary<string, string> { { "secured", "password" } // bucketName, bucketPassword } }; var cluster = new Cluster(); cluster.Authenticate(credentials); var bucket = cluster.OpenBucket("secured"); // notice no password was passed in as it’s used from the credentials |
Remember the Cluster should be a long lived object, typically set up when your application first starts and ClusterHelper is a nice way to manage the lifetime of your cluster object.
Cluster Level Query
When a N1QL query is submitted, it is up to the query nodes in the cluster to interpret the statement and execute the query. It doesn’t need to be executed under the context of a particular bucket because the query statement includes the bucket name. To help make this easier we’ve copied the Query and QueryAsync API onto the ICluster interface so you can now execute N1QL queries with the Cluster object directly. An example of using the new cluster level Query API is below:
1 2 3 4 5 6 7 |
var config = new ClientConfiguration { Servers = new List<Uri> {new Uri("http://127.0.0.1")} }; var cluster = new Cluster(config); var result = cluster.Query<Person>("SELECT * FROM `default` WHERE type = 'person';"); |
FTS Update
We've been working on improving support for the upcoming FTS (Full Text Search) and consolidating the implementations across the different SDKs. There have been a number of bugs fixed to ensure the SDK has complete support for when the feature goes GA in Couchbase Server 4.6.
Release Notes
- [NCBC-958] – Provide sane checks for max and min pool sizes.
- [NCBC-1209] – Ensure CAS is passed to Sub-Doc operations
- [NCBC-1211] – Error Bootstrapping Using .Net Core on Linux Due To Socket Keep Alives
- [NCBC-1213] – Unable to submit Compound FTS query
- [NCBC-1214] – BooleanQuery should only require one sub-query, not one of each type
- [NCBC-1216] – PhraseQuery and DocId Query throw exception during Export
- [NCBC-1225] – PoolConfigurationTests do not match min and max values
- [NCBC-1128] – Refactor FTS ISearchQueryResult so that it has parity with Java SDK
- [NCBC-1141] – When Id is not present in doc fail-fast
- [NCBC-1210] – Upgrade NetStandard projects to Common.Logging Core and Portable 3.4-Alpha2
- [NCBC-1218] – Fix broken tests impacting CI
- [NCBC-1219] – Improve or fix unit tests
- [NCBC-1220] – Update SearchClient to use CouchbaseHttpClient
- [NCBC-1222] – Fixup unit tests
- [NCBC-854] – N1QL Cross Bucket Joins
- [NCBC-1060] – Include Datastructure Support
- [NCBC-1062] – Add Cluster Level Authenticator Interface
- [NCBC-1223] – Add MediaType constants to be used instead of inline strings
- [NCBC-1194] – Bucket.Exists() returns False for a document that DOES exist when using Swedish Characters (at least) in document ID
- [NCBC-1215] – Add nuspec file for generating Net45 and NetStandard1.5 targets
- [NCBC-1217] – Set AllowUnsafe to false in Couchbase.NetStandard project
- [NCBC-1221] – Make OpenBucket throws Auth exception when cred not provided
- [NCBC-1224] – Add IBucket level Data Structure methods
How to Get It
As always, the Couchbase .NET SDK is available on/by: