When I insert new item to the bucket it is not returned back to the result.Value (see in code belove). The item is inserted to the db, though.
Here is the code:
public T Create(T item, string id)
{
item.created = DateTime.Now;
item.updated = DateTime.Now;
item.id = id;
var key = GenerateKey(item.id);
IOperationResult<T> result = _bucket.Insert(key, item);
if (!result.Success)
{
throw result.Exception;
}
// Here the null is returned
return result.Value;
}
Thank you. That’s what I came up with as well. This is strange, though. Because the same working example was shown in the official Couchbase course “CB130cs - Intro to the Couchbase SDK (C#/.NET)”
Hmm, looks like a minor bug in the course material - note that if we did do a fetch, the document would be the same as the one passed in, so your better off just slightly changing the code to return the passed in item if its needed later.