Inside samples/docdb-dotnet-starter/data/restaurant.json there are some documents with wrong type:
Example:
"address": 130 ->
breaking the code: File Locations.cs -> public string address { get; set; }.
In the local machine is working fine. But when I deployed at AWS AppRunner using AWS DocumentDB, I'm getting the following
error due this document type:
" ---> System.FormatException: Cannot deserialize a 'String' from BsonType 'Int32'.
02-21-2023 05:47:35 PM System.FormatException: An error occurred while deserializing the address property of class docdb_dotnet_starter.Models.Location: Cannot deserialize a 'String' from BsonType 'Int32'."
Record at /samples/docdb-dotnet-starter/data/restaurant.json file:
Also there is a column in the collection locations "address line 2" that it's breaking the code:
{
_id: ObjectId("55f14312c7447c3da7051b3f"),
URL: 'http://www.just-eat.co.uk/restaurants-1st-class-pizza-and-kebab-house-nottingham/menu',
address: '470 Vernon Road',
'address line 2': 'Old Basford',
name: '1st Class Pizza & Kebab House',
outcode: 'NG6',
postcode: '0AT',
rating: 4,
type_of_food: 'Pizza'
}
Corrections:
Change some documents at restaurant.json file: exemple "address": 130 to "address": "130"
Change column name address line 2 to address_line_2 at file restaurant.json
Added the attribute public string address_line_2 { get; set; } at file Locations.cs
Inside samples/docdb-dotnet-starter/data/restaurant.json there are some documents with wrong type:
Example: "address": 130 -> breaking the code: File Locations.cs -> public string address { get; set; }. In the local machine is working fine. But when I deployed at AWS AppRunner using AWS DocumentDB, I'm getting the following error due this document type:
" ---> System.FormatException: Cannot deserialize a 'String' from BsonType 'Int32'. 02-21-2023 05:47:35 PM System.FormatException: An error occurred while deserializing the address property of class docdb_dotnet_starter.Models.Location: Cannot deserialize a 'String' from BsonType 'Int32'."
Record at /samples/docdb-dotnet-starter/data/restaurant.json file:
Example: {"URL":"http://www.just-eat.co.uk/restaurants-alcaponepizza/menu","_id":{"$oid":"55f14312c7447c3da7051ce9"},"address":130,"address line 2":"Birmingham","name":"Al Capone Pizza","outcode":"B13","postcode":"8EE","rating":4.5,"type_of_food":"Pizza"}
Also there is a column in the collection locations "address line 2" that it's breaking the code: { _id: ObjectId("55f14312c7447c3da7051b3f"), URL: 'http://www.just-eat.co.uk/restaurants-1st-class-pizza-and-kebab-house-nottingham/menu', address: '470 Vernon Road', 'address line 2': 'Old Basford', name: '1st Class Pizza & Kebab House', outcode: 'NG6', postcode: '0AT', rating: 4, type_of_food: 'Pizza' }
Corrections:
My github repository with changed files: https://github.com/norberto-enomoto/docdb-dotnet-starter