Error Connecting to MongoDB

Hi Guys,

I followed the instructions connecting to the database but when testing, i got this error:

CalciteConnectionProvider.DataSourceModelMissingException: Couldn’t find the configuration file(model) for the connection

Please what does this mean:

Find below m mongo-model.json script
inline: {
_ version: ‘1.0’,_
_ defaultSchema: ‘firstdb’,_
_ schemas: [_
_ {_
_ type: ‘custom’,_
_ name: ‘firstdb’,_
_ factory: ‘org.apache.calcite.adapter.mongodb.MongoSchemaFactory’,_
_ operand: {_
_ host: ‘localhost:27017’,_
_ database: ‘firstdb’_
_ }_
_ },_
_ {_
_ name: ‘cd’,_
_ tables: [_
_ {_
_ name: ‘capture_data’,_
_ type: ‘view’,_
_ sql: 'select cast(MAP[‘uniqueId’] AS VARCHAR(30)) AS “uniqueId”\nfrom “firstdb”.“capture_data”’
_ } _
_ ]_
_ }_
_ ]_
}

Hi Namobi,

This error can occur for two possibilities:

  1. Check whether the mongo-model.json file path is given correctly in the efwd file
  2. ‘_MAP’ should be present instead of ‘MAP’ for mapping the field data types.

Let us know if this information was useful.
-Helical Insight Team

Thanks, much…
I finally was able to connect to the database!!! :smiley:
Followed the first instruction.

Although I got another error::sweat:

Error: MetadataRetrievalException: Couldn’t retrieve metadata as the request does not have parameter called ‘metadata’

This was the what I currently have on my json script:
inline: {
version: ‘1.0’,
defaultSchema: ‘firstdb’,
schemas: [
{
type: ‘custom’,
name: ‘firstdb’,
factory: ‘org.apache.calcite.adapter.mongodb.MongoSchemaFactory’,
operand: {
host: ‘localhost:27017’,
database: ‘firstdb’
}
},
{
name: ‘cd’,
tables: [
{
name: ‘firstdb’,
type: ‘view’,
sql: ‘select cast(_MAP[‘first_name’] AS VARCHAR(30)) AS “first_name”\n from “firstdb”.“table1”’
}
]
}
]
}

I’m using the _MAP above

Hi Namobi,

We could see that you are creating metadata by clicking on ‘Create’ as shown in below image:

Instead, you must click on ‘Workflow’ and create the metadata. This should fix your problem.

-Helical Insight Team

Thanks so much. It worked!