Anton Gridushko

Anton Gridushko

  • 2.1k
  • 33
  • 526

How to update one by string field in mongo.

Jan 20 2022 1:16 PM

I have work logic:

            var result45 = await _unitOfWork.Deal.UpdateOneAsync(
                new BsonDocument("_id", "f9097a32-23a7-4242-b34d-1a6d54c17e14"),
                new BsonDocument("$set", new BsonDocument("totalSum", 9999)));

I have nowork logic:

            var result45 = await _unitOfWork.Deal.UpdateOneAsync(
                new BsonDocument("_id", dealId),
                new BsonDocument("$set", new BsonDocument("totalSum", 9999)));

I do not understand why.
Please, help.


Answers (1)