Relative Content

Tag Archive for c#mongodbmongodb-query

MongoDB document does not map correctly to a C# object

QUESTION I am having the following problem with the DEMO CODE (below): When executing the line below… var customer = collection.Find(filter).FirstOrDefault(); …the following error… System.FormatException: An error occurred while deserializing the Header property of class Customer: Element ‘id’ does not match any field or property of class Header. —> System.FormatException: Element ‘id’ does not match […]

Get all keys in a dictionary

I have a collection of objects that contain a dictionary, and would like to extract only the keys and not the values in the dictionary (which are much larger than the keys, unlike in the example below) I am using MongoDb.Driver 2.10 for C#.