@foal/typeorm fetchUser class add the ObjectID type in parameters and returns
See original GitHub issueThe ObjectID type is missing in the fetchUser class, for the mangodb database with typeorm
* @export * @param {(Class<{ id: number|string|ObjectID }>)} userEntityClass - The entity class. * @returns {((id: number|string|ObjectID) => Promise<any>)} The returned function expecting an id. */ export function fetchUser(userEntityClass: Class<{ id: number|string|ObjectID }>): (id: >number|string|ObjectID) => Promise<any> { return (id: number|string|ObjectID) => getRepository(userEntityClass).findOne({ id }); }
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
ParseObjectIdPipe for MongoDB's ObjectID - Stack Overflow
I want to create a NestJs API with TypeORM and MongoDB. My entity id fields are of type ObjectID ...
Read more >ObjectId — MongoDB Manual
Returns the representation of the object as a hexadecimal string. The returned string is the str attribute. Examples. Generate a New ObjectId.
Read more >Usage of ObjectId() in MongoDB with Examples
This tutorial will explain you all about ObjectId() in MongoDB. Object ID is treated as a primary key within the Mongo DB collection...
Read more >ObjectID() — MongoDB Node.JS Driver 1.4.9 documentation
Arguments : id (string) – Can be a 24 byte hex string, 12 byte binary string or a Number. Returns: object instance of...
Read more >ObjectId | API - MikroORM
A class representation of the BSON ObjectId type. Index. Constructors. constructor. Properties. _bsontype ...
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
No problem. I suspected that testing mongodb with typeorm (still experimental) would not be easy 😃 I think the easiest thing for me is to go through mongoose.
The PR has been merged so I’m closing this issue. Version 1.9 should be released at the beginning of June.
In the meantime, you can copy paste this code in your application if you need it.