Getting fields of multiple referenced objects jasper reports

Hi all,

I’m coming to ask this here cause I’m not getting any solutions similars to what I’m looking for, the thing is, I need to run a report in a already existing mongo db, this db is formatted with multiple nested references to objects and I’m having a hard time getting the fields I need.
Jasper Reports has an embeded query builder so I can throw my query in there and it will read which are the fields returned by that query.
The problem is, that I have for example an array of documents, inside each document contains an array of documentData, each documentData contains a reference to a “data” object and a value, the “data” object does not contains any values, but is has a reference to another object that determines the “dataType” and in this last object I get to know which kind of “data” it is.

As I’m just doing the report and not designing the db I would like to get to know what can I do to solve this now and later check if there is a better way of doing all this in mongo. It seems like SQL to me, too many references of references.

I tried this query on jasper, and I get almost all the fiels, except that I need to dig into data and dataType, but it won’t go past data…

This query whitout the last unwind gets me this fields:
documents.documentData._id (this is a reference to “data”)
documents.documentData.fields (this is a list of, once again, datas)
documents.documentData.value (where the value is originally stored)

What it seems strange to me is that data, does not contains data, it’s only like type definition, and it references the dataType inside.

Hope anyone can help me a bit, I have tried all and no luck with this…

    collectionName: 'families',
	where: { $_id: 'someId' }
	    aggregate : [ 
		{ $unwind: '$documents' },
		{ $unwind: '$documents.documentData' },
		{ $unwind: '$' },
		{ $lookup: {
			'from': 'data',
			'localField': '',
			'foreignField': '_id'
			'as': 'documentType_lookup'
		{ '$unwind': 'documentType_lookup'}