[GIS] Geoserver + MongoDB: connection OK but layers list empty

geoservermongodb

I setted up Geoserver (ver. 2.5.2) with the MongoDB plugin (ver. 11.2 – http://repo.opengeo.org/org/geotools/gt-mongodb/11.2/). The connection between Geoserver and MongoDB is OK and when I create a new datastore in geoserver->stores->Add new Store, it creates the database on mongo as expected. The problem is that, if I go in layers->Add a new resource and select the correct resource, the layer's list remain empty. On the top i see only "You can create a new feature type by manually configuring the attribute names and types. Create new feature type…" but i cannot find documentation on how to use that.

Any help?
Thanks in advance

EDIT: in the goserver's log i've just found this error:

ERROR [data.mongodb] - getLayers error; command failed [mapreduce]: 
    { "serverUsed" : "[ip:port]" , 
    "errmsg" : "exception: ReferenceError: mapfields_recursive is not defined near 'ction()
    { mapfields_recursive (\"\", this);' " , "code" : 16722 , "ok" : 0.0} 

but I can't still figure out what is the problem and how to solve it.
Any ideas?

Best Answer

If you open the gt-mongodb-11.2.jar (with winrar or similar) you will find a folder called 'javascript'. There are two javascript files in it which contain the functions you have to load to your mongodb database. (The error message indicates that these are missing.) There is also an INSTALL.txt with instructions on how to do it.
One remark: Every function has a line which deletes the current function first (probably to avoid conflicts). I have found that this line somehow deletes not only the current function but all previously loaded ones too. So I would maybe omit these delete lines when loading the functions to the database.

(An additional remark: recently I have found another mongodb plugin developed by boundless which is not only faster but much easier to configure: here you can download the source code which you will have to compile yourself. And this is the documentation on how to configure it.)