The doc itself doesn’t get a temporary ID - the doc is stored using the regular doc ID, and you can obtain that document from the server as usual.
What you’re seeing with the _sync:rev: prefix is an additional doc that gets created - a temporary backup of the previous revision body, required for other clients that have an in-flight replication.
If you’re querying a bucket owned by Sync Gateway, your map functions or N1QL queries must ignore any documents whose keys start with _sync:
. Those are internal data created by Sync Gateway.