I have a set of records with the following structure:
{u'_id': ObjectId('4e60fc677fdfb50fc3000000'),
u'columns': [
{u'geodata_type': None,
u'has_geodata': False,
u'id': 1,
u'is_available': True,
u'is_key': False,
u'name': u'NOMBRE',
u'value': u'Martin'},
{u'geodata_type': None,
u'has_geodata': False,
u'id': 2,
u'is_available': True,
u'is_key': False,
u'name': u'EDAD',
u'value': 12},
{u'geodata_type': u'punto',
u'has_geodata': True,
u'id': 4,
u'is_available': True,
u'is_key': None,
u'name': u'DIRECCION',
u'value': u'humberto primero 2345'},
{u'geodata_type': None,
u'has_geodata': False,
u'id': 5,
u'is_available': True,
u'is_key': False,
u'name': u'BARRIO',
u'value': u'centro'}],
u'datasource_id': 1,
u'map_empty': True
}
I pretend to group all the documents by some of those columns and to get counts by the given column name. The thing is, I don't find a proper way to set the key argument of the group operation to let mongo group the results properly.
Any suggestion?