Upsert is saving data by converting it into camelCase

I created bucket as below and then executing upsert queries. They are putting data into database by converting in camelcase. I am using CouchbaseNetClient 2.7.13 and RunTime(Framework) .NET Core 3.1

var cluster = new Cluster(new ClientConfiguration
{
Servers = new List { new Uri(Startup.CBLiteUrl) },
QueryRequestTimeout = 10000000

});
var authenticator = new PasswordAuthenticator(Startup.CBLiteUserName, Startup.CBLitePassword);
cluster.Authenticate(authenticator);
var bucket = cluster.OpenBucket(Startup.CBLiteBucketName);
List<IDocument> doclist = new List<IDocument>();
dynamic document = new Document
{
Id = docID,
Content = testdict
};
doclist.Add(document);
var result = await bucket.UpsertAsync(doclist);

@AnushaKaidapuram

Camel case is the default behavior for serializing JSON in the Couchbase SDK. However, this is configurable by applying a custom instance of DefaultSerializer with an alternate configuration to your ClientConfiguration when bootstrapping the cluster.

var cluster = new Cluster(new ClientConfiguration
{
    Servers = new List { new Uri(Startup.CBLiteUrl) },
    QueryRequestTimeout = 10000000,
    Serializer = new DefaultSerializer(new JsonSerializerSettings(), new JsonSerializerSettings())
});

The above example will use Newtonsoft.Json defaults rather than the Couchbase defaults for serialization and deserialization.

@btburnett3
I got exception "Cannot implicitly convert type ‘Couchbase.Core.Serialization.DefaultSerializer’ to ‘System.Func<Couchbase.Core.Serialization.ITypeSerializer>’ ".
Here,Serializer = new DefaultSerializer(new JsonSerializerSettings(), new JsonSerializerSettings())
For DefaultSerializer, used “Couchbase.Core.Serialization” namespace.
For JsonSerializerSettings, used “Newtonsoft.Json”

Apologies, I was writing that code from memory, I believe it needs to be a factory lambda:

var cluster = new Cluster(new ClientConfiguration
{
    Servers = new List { new Uri(Startup.CBLiteUrl) },
    QueryRequestTimeout = 10000000,
    Serializer = () => new DefaultSerializer(new JsonSerializerSettings(), new JsonSerializerSettings())
});

@btburnett3
Hi,
It’s working! Thank you :slightly_smiling_face: