I have created two folders in my models folder and in there is have an index.ts file, which I am using to export my models. this is what my index.ts file looks like
For some reason, I am unable to run both databases at the same time. If I comment one connection out of the connections array, everything works, however, if I use both of them, I get forestadmin error screen.
Your index.ts seems to be missing a few parts compared to a forest-cli generated project.
We have a few threads on the community that may help fix your issue.
Could you try the index.[t|j]s provided in the thread?
Let me know if that fixes the issue, otherwise share the content of the index.ts once you modified it & the associated error.
Thank you for your response. I have investigated this for many hours and I am facing one small issue. I have now modified it so that I don’t need to divide my schemas into subfolders because of using multiple databases and hosting them from one single index.ts and one models folder. As you can see, this simplifies certain aspects. Therefore, when I try to run the project, I am unable to. However, if I comment out one connection, the other schemas work and vice versa.
When I try to run forest schema:update from my root folder or my dist folder, I get the error
× The configuration file “/Users/tanishpanjwani/Desktop/dibsy/dibsy-dev/v1/dibsy-forest/config/databases.js” does not exist.
× An unexpected error occurred. Please reach out for help in our Developers community (https://community.forestadmin.com/) or create a Github issue with following error: databasesConfig.map is not a function
I have tried changing directories, and even tried by changing sourceMap value in my tsconfig file but to no avail
Hey sorry I forgot one thing,
Unfortunately, our CLI is developed for JavaScript, and the way we import databaseConfig file does not match. So please change the export in config/databases.ts to
I was able to resolve the issue after much refactoring and trial and error. It seems that I was partially following this document Plug multiple NoSQL databases - Documentation which is very outdated and misleading causing me more confusion. The forest admin community post here ISSUE: Plug multiple NoSQL databases was much more helpful in helping me resolve the issue. I request you to update or remove the article.