-
Notifications
You must be signed in to change notification settings - Fork 52
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
How to make a custom field: id? #130
Comments
@Dugnist You need to create another field. |
@tothandras ok, as then i can create unique field or rewrite _id during create new document? |
@tothandras i try use "unique: true" in mongo schema and it did not working...( |
@Dugnist for what do you need a custom |
does this work or not?
|
@tothandras i need to create a full object that include field "id" on the client-side and then push them on server... |
@Dugnist hmmm.. why not just use the ids you get back when inserting objects with a mutation? so you can have the ids on the client side too for new objects |
@tothandras yes - index: { unique: true } is working. Thank you. Maybe you know some trick how can circumvent restriction with "id" field? The policy of my project require creating unique id on the client...( |
@tothandras unfortunately i cannot do any request with my custom field "ID" without default field "id"...( This mutation not working... I know why and it sadly...(
|
@Dugnist To be honest I've never heard unique id and client side in the same sentence. :) As the user has full control over the sent object, you eventually need to validate it server side. |
As i understand - now my "id" generated from mongoose "_id" field, but how to make it custom?
The text was updated successfully, but these errors were encountered: