Argument of type 'ObjectId' is not assignable to parameter of type 'string | number | Date | ObjectID | FindOneOptions
See original GitHub issueIssue 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’.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:12
- Comments:21 (8 by maintainers)
Top Results From Across the Web
Argument of type '{ id: string; }' is not assignable to parameter ...
Object literal may only specify known properties, and 'id' does not exist in type 'FindOneOptions'. Code: const result = await this.
Read more >Type is not assignable to type 'OptionalId<T>' - MongoDB
I'm trying to write a Typescript generic using the Nodejs driver v4.1.0. ... Argument of type 'T' is not assignable to parameter of...
Read more >Type 'undefined' is not assignable to type in TypeScript
The "Type 'undefined' is not assignable to type" error occurs when a possibly undefined value is assigned to something that expects a different...
Read more >Class Repository<Entity> - typeorm
Deletes entities by a given criteria. Unlike save method executes a primitive operation without cascades, relations and other operations included.
Read more >type-graphql/Lobby - Gitter
Argument of type '{ resolvers: (typeof PlaceResolver)[]; validate: boolean; emitSchemaFile: string; }' is not assignable to parameter of type ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
same issue here. version 0.2.34
I am getting the same problem, ObjectID is deprecated by mongodb but query methods only accept one of kind of ObjectID