question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

@foal/typeorm fetchUser class add the ObjectID type in parameters and returns

See original GitHub issue

The 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:closed
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Fredy22commented, Oct 9, 2019

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.

0reactions
LoicPoullaincommented, May 8, 2020

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found