{"_id": "ACA9083F",
"owner": "alice",
"readers": ["bob",…],
"category": "riddle",
"text": "Why is a…"
}
You might use these in your sync function
if (!doc.owner)
throw({forbidden: "Missing owner"});
"The owner property must be immutable."
if (oldDoc && doc.owner != oldDoc.owner)
throw({forbidden: "Owner changed"});
"The owner is the user who is creating the document."
requireUser(doc.owner);
"Only those with the 'creator' role can create documents."
requireRole("creators");