Setting ID of document

Continuing the discussion from Unofficial Anvil Firebase Integration v0.1🔥:

Is there a way to set the ID of a document when adding it to a collection?

This would be useful for instances of 1 to 1 relationships, like a collection “profiles” for each user.

If i can set the doc_id == uid, I then can pull that document using the uid.

I would no recommend changing the uid, and usually there is no need to do so.

You can just use the autogenerated uids to link documents together.
add_doc() returns the uid of the newly added document for example.

I might also missunderstand your question.

The advantage of this would be you no longer need to run a secondary query to see if that collection exist and you do not have to waste the memory in the profile collection giving it a uid field.

This only works for situations where there are strict 1 to 1 relationship. Definitely not a necessary action.