Under this schema
type Husband {
name: String
wife: Wife
}
type Wife {
name: String
husband: Husband @primary
}
and a Wife document existing, I can then do
mutation {
update_Wife(docID: "bae-5bb1a8da-0b3c-5525-96d0-f1c503b9bfb5", input: {
_husbandID: "bae-5bb1a8da-0b3c-5525-96d0-f1c503b9bfb5"
}) {_docID, _husbandID}
}
Note that docID (for wife) and _husbandID are the same.
The db doesn't prevent me from assigning a wife's docID as _husbandID value.
The db could check docID's types against local documents. The goal is that the db would help the app developer catch mistakes. Here for example, that I have to create husband and wife in one query, note down the docIDs, and then update both husband and wife with the ID of the other party. If I mistakenly swap the variables, things go astray, and the db could prevent that mistake by actually enforcing the schema.
Under this schema
and a
Wifedocument existing, I can then doNote that docID (for wife) and _husbandID are the same.
The db doesn't prevent me from assigning a wife's docID as _husbandID value.
The db could check docID's types against local documents. The goal is that the db would help the app developer catch mistakes. Here for example, that I have to create husband and wife in one query, note down the docIDs, and then update both husband and wife with the ID of the other party. If I mistakenly swap the variables, things go astray, and the db could prevent that mistake by actually enforcing the schema.