idris
Aug 5th, 2011, 02:44 PM
How do you reference unstructured, multi-level data (as a Map) in Spring Data Document MongoDB?
I'm trying to represent the following object:
{
'_id': (Object ID Here)
'name': 'john',
'data': {
'pet': 'cat',
'other': ['some', 'stuff'],
'more': { 'unstructured': 'info' }
}
}
With the following class:
@Document
public class Person {
ObjectId id;
String name;
Map<String, Object> data; // Schemaless data for which I do not know the structure
}
Right now I get an Exception in MappingMongoConverter.findTypeToBeUsed because it tries to call [dbObject.get(CUSTOM_TYPE_KEY)] on a `DBArray` (because 'other' is a `DBArray`)
Any ideas? Or is this just a bug?
I'm trying to represent the following object:
{
'_id': (Object ID Here)
'name': 'john',
'data': {
'pet': 'cat',
'other': ['some', 'stuff'],
'more': { 'unstructured': 'info' }
}
}
With the following class:
@Document
public class Person {
ObjectId id;
String name;
Map<String, Object> data; // Schemaless data for which I do not know the structure
}
Right now I get an Exception in MappingMongoConverter.findTypeToBeUsed because it tries to call [dbObject.get(CUSTOM_TYPE_KEY)] on a `DBArray` (because 'other' is a `DBArray`)
Any ideas? Or is this just a bug?