That hypothesis is invalid for a new account cuz two different person can’t have the same email from the same service provider. Let’s assume a third person have stolen Bob’s email and somehow he was able to create an account in your service. And then the real Bob come back and try to create an account with the same email. Well, if Bob have recovered his email. Your job is to offer him a way to recover that account too. You choose the strategy. Send him a recover method.
Ignoring that, if Bob tries to create an account with an existing account that he doesn’t remember exists. Your upsert will be able to tell that the account exists and ignore. So, if there is an account, the upsert will not execute and return “Done” and the values at the query request. Meaning that the user already exists. But if the user doesn’t exists, it will create one return “Done” along with the created UIDs in the UID key of the response. e.g:
{
"data": {
"q": [], # This is empty cuz there was no data before
"code": "Success",
"message": "Done",
"uids": {
"uid(v)": "0x1" # This returns the UID of the new node created.
}
},
"extensions": {...}
}