Inserted item is not returned in IOperationResult.Value property

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;
    }

CouchbaseNetClient 2.7.4 is used.

@Linkoln -

Insert doesn’t return the value back, you can just pass the item back instead.

Jeff

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)”

Here is the screen from this course

@Linkoln -

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.

-Jeff

Thank you for your reply