Comments (10)
@Dugnist You need to create another field. id
is used by Relay and it encodes the resource type along with the mongoose _id
.
from graffiti-mongoose.
@tothandras ok, as then i can create unique field or rewrite _id during create new document?
from graffiti-mongoose.
@tothandras i try use "unique: true" in mongo schema and it did not working...(
from graffiti-mongoose.
@Dugnist for what do you need a custom id
?
from graffiti-mongoose.
does this work or not?
new Schema({
identifier: { type: String, index: { unique: true } }
})
from graffiti-mongoose.
@tothandras i need to create a full object that include field "id" on the client-side and then push them on server...
from graffiti-mongoose.
@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
from graffiti-mongoose.
@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...(
from graffiti-mongoose.
@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...(
mutation {
updateDocument( input: {
name: "Name of Document",
ID : "123",
clientMutationId: "1"
}) {
changedDocument {
ID
}
}
}
from graffiti-mongoose.
@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.
What you can try is to use a plural query with the ID and then you can get the actual id to do the mutation.. it's something
from graffiti-mongoose.
Related Issues (20)
- Implicit dependency on babel-polyfill HOT 9
- Cannot set currently-valued fields to null in update mutation HOT 2
- "TypeError: Cannot read property 'forEach' of undefined" when embedded object field is a reference HOT 6
- Custom query thunk - accepts only InputObject types HOT 3
- Question on customQueries HOT 7
- Example project doesnt work with [email protected] and [email protected] HOT 1
- Async hook support HOT 2
- How to use Express Middleware for Authentication/Authorization. HOT 4
- Get specific field validation error?
- How to mutate nested Schema? HOT 3
- What is different between id and _id HOT 1
- UNMET PEER DEPENDENCY HOT 1
- Maintainer Volunteer Thread HOT 1
- Mongoose ObjectId and GraphQL id is not the same. How to link them? HOT 5
- It is possible to add some description to schema and to be reflected in the docs?
- Does graffiti-mongoose works with react-apollo ? HOT 2
- Custom mutations?
- Custom queries/mutations HOT 1
- setTypeFields bug
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from graffiti-mongoose.