Referencing Existing Entities
When adding or updating (next lesson!) data that includes existing references, you can refer to an existing subject by using either their subject id or a unique two-tuple.
For example, to create a new chat for the person with the handle, jdoe
, we could issue:
[
{
"_id": "chat",
"message": "This is Jane. Saying hi again",
"person": ["person/handle", "jdoe"]
}
]
Assuming her subject id is 1234567
, we could alternatively issue:
[
{
"_id": "chat",
"message": "This is Jane. Saying hi again",
"person": 1234567
}
]
Add a New Chat
Write a transaction!
Using the above transaction examples, create a new chat message for a person whose subject id is 9876543.