SoftwareBrothers / adminjs-typeorm

TypeORM adapter for AdminJS
MIT License
24 stars 31 forks source link

ID column not found (TypeORM & MongoDB) #9

Open Nico205 opened 3 years ago

Nico205 commented 3 years ago

Hello,

this error occurs when using @adminbro/upload using @adminbro/typeorm adapter (with MongoDB database). It's unable to determine an id column on the record and fails afterwards.

Please see the message below which refers to https://github.com/SoftwareBrothers/admin-bro/issues/95

Friendly Regards & Thanks Nico


Hey,

I've got the same error using NestJS with TypeORM and Admin-Bro.

"@admin-bro/typeorm": "^1.4.0-beta.1",
"@admin-bro/upload": "^1.2.0-beta.8",
"admin-bro": "^3.3.0-beta.33",

The model looks like this:

@Entity({
  name: 'product'
})
export class Product extends BaseEntity {

  @ObjectIdColumn()
  _id: ObjectID

  @Column()
  keys: string[]

  @Column()
  imagePaths: string[]

}

The output of console.log(record.params) is:

{ '_id._bsontype': 'ObjectID',
  '_id.id': <Buffer 5f 96 bb de b7 72 6d 17 92 50 66 72> }

Adding an additional @PrimaryColumn() to the MongoDB Entity doesn't help.

Are there any news on this bug?

Friendly Regards Nico :)

scripterkaran commented 3 years ago

I am also facing this, not really related to NestJS

image

    "admin-bro": "3.3.1",
    "admin-bro-expressjs": "^2.1.1",
    "admin-bro-mongoose": "^0.5.2",
    "admin-bro-sequelizejs": "^0.5.1",
    "admin-bro-typeorm": "^0.1.6-alpha.9",