I am trying to replace an existing documnet with an updated one and it is throwing an error ‘the output byte buffer is too small to contain the encoded data’
var bucket = await cluster.BucketAsync("");
var scope = await bucket.ScopeAsync("scopename");
var collection = await scope.CollectionAsync("collectionname");
var getResult = await collection.GetAsync("documentname");
var existingDoc = getResult.ContentAs<JObject>();
Console.WriteLine(existingDoc);
var currentCas = getResult.Cas;
Console.WriteLine($"Current Cas: {currentCas}");
var replaceResult = await collection.ReplaceAsync(updatedJson, existingDoc, options => { options.Cas(currentCas); });
Please help and let me know if there anything wrong in here .
Thanks
My first guess would be something with a string longer than allowed, especially for the document key. Can you tell me how long all your various strings are if they’re unredacted?
I’m thinking Brant is right. I’m looking at the above line of code as the likely culprit.
The first parameter of ReplaceAsync is id. You’re passing in updatedJson for the id. I don’t know what’s in updatedJson based on the code sample, but if it’s a JSON string, that likely isn’t what you meant to use for a id.