couchbaselabs / couchbaselabs/couchbase-net-examples
Issues with compiling sample code from documentation
- Dominant language
- C#
- Stars
- 18
- Forks
- 12
- PR merge metrics
- No merged PRs in 30d
Description
There were some issues when compiling a sample code from documentation. I had to add the following using statements in order for VS to recognize ClientConfiguration, PasswordAuthenticator and List objects. I ran the code with .Net SDK 2.7.12
using System;
**using System.Collections.Generic;
using Couchbase.Configuration.Client;
using Couchbase.Authentication;**
namespace Couchbase.HelloCouchbase
{
class Program
{
static void Main(string[] args)
{
var cluster = new Cluster(new ClientConfiguration
{
Servers = new List { new Uri("http://localhost") }
});
var authenticator = new PasswordAuthenticator("Administrator", "password");
cluster.Authenticate(authenticator);
using (var bucket = cluster.OpenBucket("userprofile"))
{
var document = new Document
{
Id = "Hello",
Content = new
{
name = "Couchbase"
}
};
var upsert = bucket.Upsert(document);
if (upsert.Success)
{
var get = bucket.GetDocument(document.Id);
document = get.Document;
var msg = string.Format("{0} {1}!", document.Id, document.Content.name);
Console.WriteLine(msg);
}
Console.Read();
}
}
}
}
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.