MongoDB C# - Getting BsonDocument for an Element that doesn't exist

后端 未结 5 1096
难免孤独
难免孤独 2021-02-09 07:53

So I have a BsonDocument b (let\'s say it has FirstName, LastName, Age), which you could access as b[\"FirstName\"], etc...

If I try to do b[\"asdfasdf\"] (which doesn\'

5条回答
  •  别跟我提以往
    2021-02-09 08:38

    An update to Robert's answer, the correct syntax using the C# 2.0 driver is:

    var firstName = report.GetValue("FirstName", null);
    

提交回复
热议问题