Insert only saves the documentId not the content


#1

i am following the beer sample and having an issue when i do an insert it only save the document id but the content is not getting saved. Am i missing something.

Repository

public class UserRepository : CouchbaseRepository, IUserRepository
{
public UserRepository(IBucket bucket)
: base(bucket)
{ }
public User CreateUser(User user)
{
user.Id = BuildKey(user);
return Insert(user);

    }
}

BASE Repository
public abstract class CouchbaseRepository where T :IDocument
{
private readonly IBucket _bucket;
private readonly string _designDoc;
protected CouchbaseRepository(IBucket bucket)
{
_bucket = bucket;
_designDoc = typeof(T).Name.ToLower().InflectTo().Pluralized;
}

    public virtual T Insert(T entity)
    {
        return _bucket.Insert<T>(entity).Content;
    }
}

public static class CouchbaseDatabaseHelper
{
    public static IBucket GetCouchbaseBucket()
    {
      
        //var cluster = new Cluster("couchbaseClients/couchbase");
        // return cluster.OpenBucket();

        ClusterHelper.Initialize("couchbaseClients/couchbase");
        var cluster = ClusterHelper.Get();
        return cluster.OpenBucket();
    }
}

#2

@game99

That seems odd - the Set command (Insert) will save the meta data and the body of the document, or it should fail outright. Can you perhaps create a Jira ticket and attach a sample project? You can create a Jira ticket here: http://www.couchbase.com/issues/browse/NCBC

-Jeff