‘bdfb4361-93b5-436d-bed2-2e56f3e60351’ is not a valid 24 digit hex string

I encountered this error while working with MongoDB Official C# Driver. This error occured when I was trying you insert some test data into a collection. Here’s the snap of error it shown

Later in the course I figured out i was using BsonReprentation Attribute to decorate the Bson data type as objectId.

When I changed the attribute to BsonId it started working fine. 

Below is my model before and after the changes.

Hope it helps somebody!


What is Affiliate Marketing?

Any website or business that provides links or sales to the site actually making the sale through their own marketing efforts is called Affiliate, and, this whole process is called affiliate marketing.

Following are one of the top Affiliate Networks who offers Affiliate Programs:

  1. LinkShare
  2. Commission Junction 
  3. Amazon 
  4. ClickBank 
  5. Google