In version 3.0.0.9-preview we could create document with null values and they would be inserted as null in Cosmos DB.
Now in 3.0.0.10-preview those values are ignored, so queries that looks for these values are broken.
Ex: Select * from c where c.Property = null now returns no documents since c.Property is undefined and not null.
@jriouxrandstadca The default json serializer has these options: https://github.com/Azure/azure-cosmos-dotnet-v3/blob/master/Microsoft.Azure.Cosmos/src/CosmosJsonSerializerCore.cs#L17
It doesn't seem to have changed. Do you have a repro that we can use with 3.0.0.9-preview and 3.0.0.10-preview and compare results?
Here is a really simple program that inserts a document in Cosmos.
using System.Threading.Tasks;
using Microsoft.Azure.Cosmos;
namespace ConsoleApp1
{
internal static class Program
{
private const string Endpoint = "<Put endpoint here>";
private const string AuthKey = "<Put auth key here>";
private static async Task Main(string[] args)
{
var cosmosClient = new CosmosClientBuilder(Endpoint, AuthKey)
.UseConnectionModeDirect()
.Build();
var container = cosmosClient.Databases["<Database name>"].Containers["<Container name>"];
dynamic document = new
{
id = "1234",
Prop1 = default(string),
PartitionKey = "1234"
};
await container.Items.UpsertItemAsync(document.PartitionKey, document);
}
}
}
When I run it with 3.0.0.10-preview, I get the following in Cosmos
{
"id": "1234",
"PartitionKey": "1234",
"_rid": "UJxeAN+LVrgnJwAAAAAAAw==",
"_self": "dbs/UJxeAA==/colls/UJxeAN+LVrg=/docs/UJxeAN+LVrgnJwAAAAAAAw==/",
"_etag": "\"020052cd-0000-0a00-0000-5cf03c3f0000\"",
"_attachments": "attachments/",
"_ts": 1559247935
}
When I run it with 3.0.0.9-preview, I get the following in Cosmos
{
"id": "1234",
"Prop1": null,
"PartitionKey": "1234",
"_rid": "UJxeAN+LVrgnJwAAAAAAAw==",
"_self": "dbs/UJxeAA==/colls/UJxeAN+LVrg=/docs/UJxeAN+LVrgnJwAAAAAAAw==/",
"_etag": "\"020055cd-0000-0a00-0000-5cf03ccb0000\"",
"_attachments": "attachments/",
"_ts": 1559248075
}
As you can see Prop1 is removed when using 3.0.0.10-preview.
@j82w & @simplynaveen20 is this addressed now?
Fix is shipped with 3.0.0.18-preview.
Most helpful comment
Here is a really simple program that inserts a document in Cosmos.
When I run it with
3.0.0.10-preview, I get the following in CosmosWhen I run it with
3.0.0.9-preview, I get the following in CosmosAs you can see
Prop1is removed when using3.0.0.10-preview.