Custom API - Unable to call GET on internal service

I am quite new to this platform and building things based on the documentation.

Background:
I want to create a Custom API which basically invokes a mongoDB service to pull the data from multiple tables and compose the output.

Trouble:
I have created the NodeJS service under Service tab and assigned the role mapped with the user.
I don’t see the internal service is getting invoked at all. Below is the code snippet.

var result = {dummy: “dummy”};
var callback = (body, response) => {
result = JSON.parse(body);
}
// get all records using internal URL
let url = mongodb/_table/tbl_account;
platform.api.get(url, null, callback);
return result;

Value your help.
Thanks

Hello @rmadhavan.
As far as what I understand, you have created a MongoDB service and a scripted service. And in your nodejs scripted service, you are trying to call the tables in MongoDB database.

In order to pull data from multiple tables, you can use DreamFactory’s data mesh feature. It allows you to combine data from two tables in the same database or you can combine multiple tables residing on different databases like MS SQL or MYSQL as well. You can find out more here - https://blog.dreamfactory.com/easier-data-marts-with-dreamfactory-data-mesh/

This is an easier way to combine two tables with point and click. You can have multiple tables joined together accessible through a single endpoint.

Scripting service
If you want to go to the scripting service route, this is a great place to start - https://guide.dreamfactory.com/docs/chapter06.html#modifying-existing-api-endpoint-logic. This will allow you to add the NodeJs scripted logic to your MongoDB service.

Let us know if you have any more questions