-1

Since data set in SpagoBI could be created using scripts, I need to connect, query my MongoDB data base using javascript (or Groovy). I need to use scripts to be able to execute aggregation on the mongoDB data, I can't use aggregation directly on my MongoDB because my data type is String

I dont know how to access my Database using scripts

Any ideas?

Willi Mentzel
  • 27,862
  • 20
  • 113
  • 121
sabrina2020
  • 2,102
  • 3
  • 25
  • 54

2 Answers2

2

You should create a Mongo dataset. The steps to create are:

Step1: Create a Mongo datasource in the administrator console. Notes: the type must be JDBC and the value for Class input field must be "mongo" JDBC: {unit_host}:{port}/${db} CLASS: mongo

Step2: now you can create a dataset. The procedure is the same of the query datasets. The difference here is the language.. JS instead of SQL.

Take a look at the SpagoBI wiki in particolar here: http://wiki.spagobi.org/xwiki/bin/view/spagobi_server/data_set#HQueryDataSet28Mongo29

0

When connecting to mongoDB, you pass auth stuff in the url. Since the scripts lies on the client side, it would be hard to make the connection secure (unless you are talking about backend JavaScript). Anybody would be able to see how to connect to your DB and for instance delete all content.

I would suggest a simple api to interface the database. Then u control the access to what a user can do towards the database.

Or have I misunderstood the scenario?

William
  • 741
  • 4
  • 9