Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8031475
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T01:06:42+00:00 2026-06-05T01:06:42+00:00

I am in Mongo-C# environment and using 10Gen Mongo driver. i am facing a

  • 0

I am in Mongo-C# environment and using 10Gen Mongo driver. i am facing a problem when I am trying to deserialize the data inside the Mongo document when it has a sub document and that sub document is not strongly typed. In other words, if the sub document is an Expando or simply an anonymous object() then it give errors out while deserializing with the following error:

System.IO.FileFormatException: A document being deserialized to
System.Object must be empty.

We I can put a filter before and after the Mongo read/write which converts my Object into a BSONDocument on the fly but I think there is not cast available between BSOnDocument and (Expando or anonymous type).

Writting a custom deserialization tool sounds like too much work for this. I am just wondering is someone has faced this problem before and how they have handled this problem?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T01:06:43+00:00Added an answer on June 5, 2026 at 1:06 am

    Currently, since the 10gen driver is based on .NET 3.5, we do not support dynamic objects. Currently, the way to handle this is using an ExtraElements member. You can read about it here: http://www.mongodb.org/display/DOCS/CSharp+Driver+Serialization+Tutorial#CSharpDriverSerializationTutorial-Supportingextraelements.

    We will be supporting .NET 4.0 in full at a later date and with that will come full support for dynamic objects. If you really need the feature now, you can see my spike of side-by-side support using another assembly here: https://github.com/craiggwilson/mongo-csharp-driver/tree/dynamic. However, it is untested and is truly just a spike, so be wary.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using C# Mongo DB Driver for database operation. I want to get
I'm using the nginx/PHP/MongoDB stack and trying to set up my development environment on
NB: I'm using the Mono environment, if that makes a difference. I'm writing some
Mongo docs state: The Mongo multikey feature can automatically index arrays of values. That's
In Mongo my understanding is that you can have databases and collections. I'm working
I have a Mongo collection that simply references an ID to another collection. Hypothetically
The PHP Mongo Driver allows me to execute code in the database. Does this
I use mongodb-erlang driver for mongo db access in erlang. Some of my command
I am currently trying to set up a development environment for learning Ruby. The
In Windows Mango OS , is there any scripting environment that is supported? Does

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.