Couchbase
  • Why NoSQL?
  • Couchbase Server
  • Download
  • Resources
  • Careers
Home | Forums | Couchbase | Couchbase Server 2.0

.net client connectivity

1 reply [Last post]
  • Login or register to post comments
Tue, 01/15/2013 - 06:26
sabithvm
Offline
Joined: 11/27/2012
Groups: None

i was trying out a sample CB client code that was working well a couple of days back (i had to look at other parts ). suddenly the store calls are returning false indicating the object was not saved. the code is as below. How can i trouble shoot the issue ?

var newBeer =
@"{
""name"": ""Old Yankee Ale"",
""abv"": 5.00,
""ibu"": 0,
""srm"": 0,
""upc"": 0,
""type"": ""beer"",
""brewery_id"": ""110a45622a"",
""updated"": ""2012-08-30 20:00:20"",
""description"": ""A medium-bodied Amber Ale"",
""style"": ""American-Style Amber"",
""category"": ""North American Ale""
}";

var config = new CouchbaseClientConfiguration();
config.Urls.Add(new Uri("http://localhost:8091/pools/"));
config.Bucket = "default";

log.Debug("Created Config to connect to default bucket.");

var client = new CouchbaseClient(config);

ServerStats _stats = client.Stats();

var key = BitConverter.ToString(HashAlgorithm.Create("SHA1")
.ComputeHash(Encoding.UTF8.GetBytes(newBeer)))
.Replace("-", "").Substring(0, 10).ToLower();

var result = client.Store(StoreMode.Add, key, newBeer);

Top
  • Login or register to post comments
Tue, 01/15/2013 - 09:32
john
Offline
Joined: 01/05/2012
Groups: None

Some suggestions noted here - http://www.couchbase.com/forums/thread/troubleshooting-net-client-librar...

But also, just want to make sure you're using a new key each time. The code above will work once and fail subsequently. You're using StoreMode.Add, which fails if a key exists.

Top
  • Login or register to post comments
  • Login or register to post comments
  • Login
  • Register

Company

  • About Us
  • Leadership
  • Customers
  • Partners
  • Contact Us

Product

  • Couchbase Server
  • Couchbase SDKs
  • Use Cases
  • Documentation
  • Forums

Open Source

  • Couchbase Project
  • Couchbase vs. CouchDB

Commercial

  • Subscriptions & Support
  • Training & Services

News

  • Blog
  • Newsletter
  • Press Releases
  • Buzz

Follow Us

    
  • Customer Login
  • Terms of Service
  • Privacy Policy
  • Trademark Policy
  • Site Map

© 2013 COUCHBASE All rights reserved.

Sign in to Couchbase Community

close
  • Create new account
  • Request new password
You are logging into the Forums, Wiki and Issue Tracker