rules_version = \'2\';
service cloud.firestore {
match /databases/{database}/documents {
match /users/{usersID} {
allow read;
allow write: if request.auth.
What you are trying to do is not possible with security rules. This would require that you be able to perform a query on desksCollection for documents that match the criteria of having a field with a certain value. However, performing queries is not possible in security rules. You can fetch a document by its ID, but that won't help you here, because you don't know which document to fetch.
If you require that deskName be unique, then consider using that value as the ID of the document. Then you can write a rule to prevent updates if the document already exists.