-
Notifications
You must be signed in to change notification settings - Fork 135
Clarification on casting string to ObjectId #308
Comments
could you provide your model? |
Contact modal:
Which extends a shared class:
The add contact resolver:
The InjectCreated() decorator:
|
basic mistake, fix it with this below: @Property({ index: true, ref: "Business" })
createdBusiness: Ref<Business> Note: use ref as a string do avoid Errors like "cant use 'Business' before creation" PS: if this does not answer your question, please provide what |
I basically have the same question. How am I supposed to convert a string to a ref-object? If I do something like this |
@Laubeee please use the new repository for questions, this repo is not maintained anymore |
phew. It sure seems to be difficult to actually get an answer to questions in this repo. Nevertheless I am sure I won't be the last that's gonna be led here by google, so posting an answer here (if there is a simple one) would still be beneficial. |
@Laubeee i would like this repo to be archived (like #398) but only the repository owner can do this
i know, but i say this because much changed since the move to the new repo, because this one couldnt be maintained (the original author abandoned this project, and the other 2 maintainers that i know of either left or didnt have much time to review pr's and maintain this project)
the answer as low because this repo here is old, and if written here it is either not noticed, or targeted at 5.x or earlier which are versions that are not maintained by the newer project anymore (version 6 and 7 are already out on the new one) PS: and this is because and documentation website exists now for the project instead of an long readme (most of the new questions here are answered by this) |
Hey Everyone,
Confused if this is the proper implementation...
I created a field called 'createdBusiness' which has a default value of ObjectId (imported from 'mongod') and it is stored in the DB as an ObjectId
When I try and do:
It returns no values, but if I create an ObjectId and pass it in it works fine as below
Now from my previous experience I always found that mongoose would cast the string value into an ObjectId but it doesn't happen here. I just want to clarify this is expected behavior.
Thanks for looking.
The text was updated successfully, but these errors were encountered: