When you do the “typical” Create Fauna can generate an ID that it knows with all certainty that there is no history for that document. But that’s not the case if you provide the ID.
Consider that when you Delete a Document, it doesn’t outright remove it, rather it adds a “remove” event to the history. Later, you can Create with that same ID. When doing so, it doesn’t just create a new document, it appends to that Document’s history with a “create” record. If there is no previous history, then it will be the only history record, but it is still reaching in to the history mechanism to perform the action.
Thanks, it makes sense. Although I wish there was a way to create new documents with an id that didn’t require users having the “History Write” permissions.
When needing to create documents with references to other documents I’ve resorted to this pattern:
In some other cases I’ve needed document properties based on the document id. In this case there’s no other way than to resort to using NewId(). For example when modeling a file in an object storage system:
If you write to a document more than once in a single query it only uses up one Transaction Write Op (Compute adds up if you do it a lot). But that means you can do this with only “create” and “write” privileges, and still only costs 1 TSO