# Uh oh, no collections found. (creating a fresh project, then turning into typescript = not fetching anything)

**URL:** <https://community.forestadmin.com/t/uh-oh-no-collections-found-creating-a-fresh-project-then-turning-into-typescript-not-fetching-anything/2989>\
**Category:** Help me!\
**Tags:** setup, typescript\
**Created:** [July 26, 2021, 8:42pm UTC](https://community.forestadmin.com/t/uh-oh-no-collections-found-creating-a-fresh-project-then-turning-into-typescript-not-fetching-anything/2989 "2021-07-26T20:42:06Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Emixam23](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/emixam23/32/1350_2.png) [@Emixam23](https://community.forestadmin.com/u/Emixam23)\
**Post date:** [July 26, 2021, 8:42pm UTC](https://community.forestadmin.com/t/uh-oh-no-collections-found-creating-a-fresh-project-then-turning-into-typescript-not-fetching-anything/2989/1 "2021-07-26T20:42:06Z")

</div>

Hello! 🙂

I thought it was the good time to close my previous issue as I think that now, I have a reproducible bug 🙂

As I was trying to update my project from version 5.xxx to 7/8, I was like (at the end), let’s create a fresh new project.

I so created a new project (mostly to test the upgrade/translate) with the latest version of `forest-cli`. Well, if you create a project, then following (in the right order, from top to bottom) the following doc:

- [v7 | Woodshop for old agent generation](https://docs.forestadmin.com/woodshop/how-tos/translate-your-project-into-typescript/v7)
- [Migrate Mongoose files | Woodshop for old agent generation](https://docs.forestadmin.com/woodshop/how-tos/translate-your-project-into-typescript/v7/migrate-mongoose-files)

You will see that you get this amazing.. empty… screen `Uh oh, no collections found.`

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/forest/original/2X/6/6e2dde6a4a3e74c4bc9b68a034ca0502678b35b9.png)

> Note: It might have some breaking changes between the version 8 and your doc, I am aware of it. I just want to get to the latest version so I don’t have to struggle for a while…

## Expected behavior

When I follow the two following documentation, I should be able to access my database. When I create the project, I have access to it.

## Actual behavior

Once I translate `config/databases.ts`, `middlewares/forestadmin.ts`, `models/index.ts` and the models under `models/`, I have this screen…

I tried for a while to see if there is any “hidden logs” or “silent errors” but nothing…

## Failure Logs

I have no logs 😕

## Context

Let me share you my files 🙂

**config/database.ts**

```javascript
import { ConnectionOptions } from "mongoose";
import { DatabaseConfiguration } from "forest-express-mongoose";
import { resolve } from 'path';

const databaseOptions: ConnectionOptions = {
  useNewUrlParser: true,
  useUnifiedTopology: true,
};

const databasesConfiguration: DatabaseConfiguration[] = [{
  name: 'default',
  modelsDir: resolve(__dirname, '../models'),
  connection: {
    url: process.env.DATABASE_URL,
    options: { ...databaseOptions },
  },
}];

export default databasesConfiguration;

```

**middlewares/forestadmin.ts**

```javascript
import * as chalk from 'chalk';
import { join } from 'path';
import { init, LianaOptions } from "forest-express-mongoose";
import { objectMapping, connections } from '../models';
import { Application } from "express";

export = async function forestadmin(app: Application): Promise<void> {
  const lianaOptions: LianaOptions = {
    configDir: join(__dirname, '../forest'),
    envSecret: process.env.FOREST_ENV_SECRET,
    authSecret: process.env.FOREST_AUTH_SECRET,
    objectMapping,
    connections,
  }

  app.use(await init(lianaOptions));

  console.log(chalk.cyan('Your admin panel is available here: https://app.forestadmin.com/projects'));

  return;
};

```

**models/notes.ts**

```javascript
// This model was generated by Lumber. However, you remain in control of your models.
// Learn how here: https://docs.forestadmin.com/documentation/v/v6/reference-guide/models/enrich-your-models
import {Schema} from 'mongoose';

export interface INote {
    created_at: number,
    name: string,
    content: string,
}

// This section contains the properties of your model, mapped to your collection's properties.
// Learn more here: https://docs.forestadmin.com/documentation/v/v6/reference-guide/models/enrich-your-models#declaring-a-new-field-in-a-model
const schema = new Schema<INote>({
    'created_at': {type: Number, required: true},
    'name': {type: String, required: true},
    'content': {type: String, required: true},
}, {
    timestamps: false,
});

export default schema;

```

**models/index.ts**

```javascript
import * as Mongoose from 'mongoose';
import {model} from 'mongoose';
import databasesConfiguration from '../config/databases';
import noteSchema, {INote} from './note';

const connections: Record<string, Mongoose.Connection> = {};
const objectMapping = Mongoose;

const connection = Mongoose.createConnection(databasesConfiguration[0].connection.url, databasesConfiguration[0].connection.options);
connections[connection.name] = connection;

let Notes = model<INote>('Notes', noteSchema, 'Notes');

export {
    objectMapping,
    connections,
    Notes,
};

```

**package.json**

```javascript
{
  "name": "emixam23-update1",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node ./dist/server.js",
    "build": "rm -rf ./dist && npm run compile && npm run cp-config",
    "dev": "tsc-watch --onSuccess \"node ./dist/server.js\"",
    "compile": "tsc",
    "lint": "eslint . -c .eslintrc.json --ext .ts",
    "cp-config": "cp .env ./dist/"
  },
  "dependencies": {
    "body-parser": "1.19.0",
    "chalk": "~1.1.3",
    "cookie-parser": "1.4.4",
    "cors": "2.8.5",
    "debug": "~4.0.1",
    "dotenv": "~6.1.0",
    "express": "~4.17.1",
    "express-jwt": "6.0.0",
    "forest-express-mongoose": "^8.0.0",
    "mongoose": "~5.8.2",
    "morgan": "1.9.1",
    "require-all": "^3.0.0"
  },
  "devDependencies": {
    "@types/express": "^4.17.13",
    "@types/mongoose": "^5.11.97",
    "@types/node": "^16.4.3",
    "tsc-watch": "^4.4.0",
    "typescript": "^4.3.5"
  }
}

```

**tsconfig.json**

```javascript
{
  "compilerOptions": {
    "module": "commonjs",
    "moduleResolution": "node",
    "pretty": true,
    "sourceMap": false,
    "target": "es2017",
    "outDir": "./dist",
    "baseUrl": "./",
    "types" : ["node", "express", "forest-express-mongoose"],
    "allowJs": true
  },
  "include": ["./**/*", ".env"],
  "exclude": ["node_modules", "dist"]
}

```

* * *

I hope I will be able to make it work soon, really need it to move forward in our project 🙂

Thanks again for your work

Max

---

<div class="post-metadata">

**Author:** ![anon36130554](https://avatars.discourse-cdn.com/v4/letter/a/b3f665/32.png) [@anon36130554](https://community.forestadmin.com/u/anon36130554)\
**Post date:** [July 27, 2021, 9:51am UTC](https://community.forestadmin.com/t/uh-oh-no-collections-found-creating-a-fresh-project-then-turning-into-typescript-not-fetching-anything/2989/2 "2021-07-27T09:51:19Z")

</div>

Hello @Emixam23 👋

I’m glad to see that you re-created a project from scratch to use TypeScript 🙌

I’m also sorry that you are encountering issues.

By looking at your file, I’ve seen that you are creating a connection with `createConnection`, but you don’t use it to instantiate you models. You are using `model` directly from the `mongoose` package, and if I’m not mistaken this adds models in the default mongoose connection. By using the `createConnection` function, you are not setting any default connection.

Can you try to instantiate your models using the following please ?

`connection.model<INote>('Notes', noteSchema, 'Notes')`

Thanks for the files you shared, this really helps to investigate.

Keep me in touch 🙌

---

<div class="post-metadata">

**Author:** ![Emixam23](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/emixam23/32/1350_2.png) [@Emixam23](https://community.forestadmin.com/u/Emixam23)\
**Post date:** [July 29, 2021, 6:24am UTC](https://community.forestadmin.com/t/uh-oh-no-collections-found-creating-a-fresh-project-then-turning-into-typescript-not-fetching-anything/2989/3 "2021-07-29T06:24:35Z")

</div>

Hey @anon36130554

What a mistake on my end… Thanks xD

Yes because I created my project with an old version of forest admin (v5 i guess) and so it’s too hard to update everything manually, so I recreated from scratch and now translating into typescript 🙂

Best,

---

<div class="post-metadata">

**Author:** ![anon36130554](https://avatars.discourse-cdn.com/v4/letter/a/b3f665/32.png) [@anon36130554](https://community.forestadmin.com/u/anon36130554)\
**Post date:** [July 29, 2021, 8:08am UTC](https://community.forestadmin.com/t/uh-oh-no-collections-found-creating-a-fresh-project-then-turning-into-typescript-not-fetching-anything/2989/4 "2021-07-29T08:08:51Z")

</div>

Hello @Emixam23 👋

Glad we figured the issue out!

Speaking about TypeScript, you generated a fresh project, and we have recently released version 8 of our lumber project. That being said, please keep in mind that the woodshop you used is intended to be used for projects version 7.

If you encounter any issue regarding types, architecture gap between version 7 and 8, or if you need any help to get your version 8 typescript project running, please don’t hesitate to create ticket and to ping me in. I will be glad to help you out 🙂

Best,

Steve.

---

<div class="post-metadata">

**Author:** ![Emixam23](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/emixam23/32/1350_2.png) [@Emixam23](https://community.forestadmin.com/u/Emixam23)\
**Post date:** [July 29, 2021, 10:04am UTC](https://community.forestadmin.com/t/uh-oh-no-collections-found-creating-a-fresh-project-then-turning-into-typescript-not-fetching-anything/2989/5 "2021-07-29T10:04:17Z")

</div>

Hey @anon36130554

Yeah, you right, as I said, I wanted to start fresh with your latest version, so I will be away from these upgrading challenges for a while 🙂

Alright, I’ve created another issue, I just got a reply but I can ping you for sure 🙂

I am also glad to find out those kind of issue (documentation, foresdtadmin itself, etc) because I know for sure it’ll help future customers of yours, even current ones 🙂

Thanks again for your help 🙂

Max
