Insert into Bucket ONLY works the first time


I have a huge problem.

I have a WCF Service which I host in IIS which interacts with Couchbase.
I insert a document using the “Insert” method and returns a result which is an IOperationResult but the insert works the first time and returns an “Id, Cas,Content” but thereafter these values are null.

Please HEEEEELP because i slit my wrists lol.

Hi @MarvelousMe,

Can you post the code that you’re using in WCF to insert into Couchbase?

Hi @matthew.groves

Here is my method that is called from my WCF Service and in the code body you will see that I create a Document then insert that Document into Couchbase.
First time a CAS id.
I have a RESTful WCF Service that passes json. I am using SoapUI to test.

Thanks in advance :slight_smile:

public CouchBaseResponse Append(IEvent @event)
CouchBaseResponse response = new CouchBaseResponse();

        var _event = @event as StreamEvent;

        var @eventId = _event.StreamId;

        IOperationResult<JObject> result;

            var doc = new Document<dynamic> { Id = string.IsNullOrEmpty(@eventId) ? "UNKNOWN" : "EVENTSTORE_" + @eventId, Content = JObject.Parse(JsonConvert.SerializeObject(@event)) };
            var docResult = _bucket.Insert(doc);

            if (docResult.Id != "0" || docResult.Id != null)
                response.Message = string.Format("Event: \"{0}\" was successfully created.", _event.Message.EventName.ToString());
        catch (Exception ex)
            response.Message = "Exception";
            response.Exception = string.Format("Exception:"+Environment.NewLine+"{0}", ex.ToString());

        return response;