Question: My MongoDB document structure is as follows and some of the factors are NaN.

```
  _id :ObjectId("5feddb959297bb2625db1450")
factors: Array 
   0:Object
     factorId:"C24"
     Index:0
     weight:1
   1:Object
     factorId:"C25"
     Index:1
     weight:1
   2:Object
     factorId:"C26"
     Index:2
     weight:1
name:"Growth Led Momentum"

```

I want to convert it to pandas data frame as follows using pymongo and pandas.

```
|name                   | factorId | Index | weight|
----------------------------------------------------
|Growth Led Momentum    | C24      | 0     | 0     |
----------------------------------------------------
|Growth Led Momentum    | C25      | 1     | 0     |
----------------------------------------------------
|Growth Led Momentum    | C26      | 2     | 0     |
----------------------------------------------------

```

Thank you

Answer: 
You need 2 things here:

1. Your `MongoService` needs to be marked with `@Injectable()` so that Nest can read the metadata of the constructor and set up the injection properly
2. If your `ConfigModule` does not have a globally exported `ConfigService`, then in `MongooseModule.forRootAsync()` along with the `useClass` you need to have `imports: [ConfigModule]` so that you can inject the `ConfigService`
```html
@Module({ 
  imports: [ 
    MongooseModule.forRootAsync({ 
      imports: [ ConfigModule ], 
      inject: [ConfigService],
      useClass: MongoService
  })
})
```