Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting the ObjectId from an non-populated refs #38

Open
Onimishra opened this issue Dec 4, 2019 · 0 comments
Open

Getting the ObjectId from an non-populated refs #38

Onimishra opened this issue Dec 4, 2019 · 0 comments

Comments

@Onimishra
Copy link

Based on example4, the non-populated ref has type Types.ObjectId | Comment. It is possible to get it to become Comment, by calling populate and that makes sense - at that point we are sure that the object has been populated and contains Comment.

However, up until that point, shouldn't the type be Types.ObjectId? Or at least provide a depopulateTs method that would reduce the type to Types.ObjectId and call depopulate underneath (just like populateTs does).

It might be that I'm doing something wrong, so please if you know of a better way to pass only the ObjectId of a ref after I just loaded up the containing document, let me know :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant