typeorm: Argument of type 'ObjectId' is not assignable to parameter of type 'string | number | Date | ObjectID | FindOneOptions
Issue type:
[ ] question [ x] bug report [ ] feature request [ ] documentation issue
Database system/driver:
[ ] cordova
[ x] mongodb
[ ] mssql
[ ] mysql
/ mariadb
[ ] oracle
[ ] postgres
[ ] cockroachdb
[ ] sqlite
[ ] sqljs
[ ] react-native
[ ] expo
TypeORM version:
[x ] latest
[ ] @next
[ ] 0.x.x
(or put your version here)
Impossible to execute findOne(<ObjectID>)
import {ObjectID} from "mongodb";
....
async changeGalerie(id_photo:ObjectID, acces: number) {
let photo = await this.candidatPhotoRepository.findOne(id_photo);
}
error TS2345: Argument of type ‘ObjectId’ is not assignable to parameter of type ‘string | number | Date | ObjectID | FindOneOptions<CandidatPhoto> | Partial<CandidatPhoto>’. Property ‘generate’ is missing in type ‘ObjectId’ but required in type ‘ObjectID’.
About this issue
- Original URL
- State: open
- Created 5 years ago
- Reactions: 13
- Comments: 22 (8 by maintainers)
same issue here. version 0.2.34