Insert two documents using the following JSON documents. Note that the "Irrigated land" field is a string in the first document and it is a sub-document in the second document.
{ "code": "aa", "name": "Aruba", "geo": { "Location": "Caribbean, island in the Caribbean Sea, north of Venezuela", "Geographic coordinates": { "N": { "deg": 12, "min": 30 }, "W": { "deg": 69, "min": 58 } }, "Irrigated land": "NA (2008)" } } { "code": "ac", "name": "Antigua and Barbuda", "geo": { "Location": "Caribbean, islands between the Caribbean Sea and the North Atlantic Ocean, east-southeast of Puerto Rico", "Geographic coordinates": { "N": { "deg": 17, "min": 3 }, "W": { "deg": 61, "min": 48 } }, "Irrigated land": { "quantity": 1.3, "unit": "sq km" } } }
Submit a SELECT * query to retrieve the documents. See the attached screenshot. ResultSet.getObject(columnIndex)
returns the following errors for the first document:
Error: .getObject(10): NA (2008) is a primitive type; cannot retrieve the 'quantity' property from it.
Error: .getObject(11): NA (2008) is a primitive type; cannot retrieve the 'unit' property from it.
|
39 KB
We found this problem using the World Factbook dataset. If you are interested in the full dataset, you can download the JSON documents from https://github.com/twigkit/worldfactbook-dataset.git.
I see. I've enforced this exception during development phases to ensure that the documents are properly flattened, but these new scenarios indicate that this error is not adequate for unstructured collections, where the values for a given field has different types from one document to another.
What I can do in this case is to return MongoNoValue
instead of throwing that exception ( "NA (2008) is a primitive type .... " ).
I see. I've enforced this exception during development phases to ensure that the documents are properly flattened, but these new scenarios indicate that this error is not adequate for unstructured collections, where the values for a given field has different types from one document to another.
What I can do in this case is to return MongoNoValue
instead of throwing that exception ( "NA (2008) is a primitive type .... " ).
Issue #8424 |
Closed |
Fixed |
Resolved |
Completion |
No due date |
Fixed Build nosql-jdbc 1.0.0 |
No time estimate |
1 issue link |
relates to #10444
Issue #10444Different format of FLATTEN_ARRAY when aliases used |
We found this problem using the World Factbook dataset. If you are interested in the full dataset, you can download the JSON documents from https://github.com/twigkit/worldfactbook-dataset.git.