Anton Gridushko

Anton Gridushko

  • NA
  • 33
  • 1.5k

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)