I have an unusual setup where I am inserting data into a MongoDB from a PHP site. The data is then read by .NET and served up as an API.
After inserting a record (via PHP) the .NET API throws the following error when trying to read the data.
An error occurred while deserializing the Id property of class Project.ModelClass: Cannot deserialize Guid from BsonType ObjectId.
The code doing the insert is:
$item = Item::create(array(
// fields
));
And the model class being read into has an Id field like this:
public Guid Id { get; set; }
The API will correctly serve up other items in the same collection that have been imported from another datasource.
Do I need to do something special in the PHP insertion to allow the Id to be read and deserialised into the .NET model class?
Any help would appreciated!
Stuart