MongoDB
 SQL >> Database >  >> NoSQL >> MongoDB

Supporto System.Dynamic.DynamicObject nel driver C# MongoDB

Puoi convertire un documento BSON in oggetto dynamic usando Json.NET. L’estensione può sostituire gli ObjectId con stringhe e deserializzare il JSON:

dynamic obj = collection.FindOneByIdAs<BsonDocument>(someObjectId).ToDynamic();

Assicurati di referenziare Newtonsoft.Json.