public Task SetPrice(Guid id, decimal price) {
|
MongoClientSettings settings = MongoClientSettings.FromUrl(new MongoUrl(Environment.GetEnvironmentVariable("DB")));
|
var mongoConnection = new MongoDB.Driver.MongoClient(settings);
|
var collection = mongoConnection.Database.GetCollection<BsonDocument>("test");
|
return collection.UpdateOneAsync(Builders<BsonDocument>.Filter.Eq("_id", id), Builders<BsonDocument>.Update.Set("price", price), new UpdateOptions {IsUpsert = true});
|
}
|
as a result, I get
{
"_id" : NUUID("ecefa3d7-8553-446a-ac46-6f565d05d33a"),
*"price" : "22.3"*
}
But I expect to get
{
"_id" : NUUID("ecefa3d7-8553-446a-ac46-6f565d05d33a"),
"price" : *NumberDecimal("22.3")*
}
|