-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Firestore replication data creation and rules #6707
Comments
Can you reproduce this in a unit test? |
I can reproduce this in an unit test, but when I try to fix it, it not works :/
I also tried with real firestore instead of emulator, with the same result. I do not find any explanation or issue about this behavior... For my project I changed for the user uid in the collection path, but It could be fine for share data between users (with a |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed soon. Please update it or it may be closed to keep our repository organized. The best way is to add some more information or make a pull request with a test case. Also you might get help in fixing it at the RxDB Community Chat If you know you will continue working on this, just write any message to the issue (like "ping") to remove the stale tag. |
I found the problem. When we query an non-existent document ID, firestore does not generate the I tested this code: const doc1 = await addDoc(ownershipCollection, {name: 'test1', owner: ownerUid});
console.log('doc1 added:', doc1.id);
const doc2 = await addDoc(ownershipCollection, {name: 'test1', owner: ownerUid});
console.log('doc2 added:', doc2.id);
const docs1 = await getDocs(query(ownershipCollection, where('owner', '==', ownerUid)));
const ids = docs1.docs.map(doc => doc.id);
console.log('docs1:', docs1.docs.map(doc => doc.id));
const docs2 = await getDocs(query(ownershipCollection, where('owner', '==', ownerUid), where(documentId(), 'in', ids)));
console.log('docs2:', docs2.docs.map(doc => doc.id));
const docs3 = await getDocs(query(ownershipCollection, where('owner', '==', ownerUid), where(documentId(), 'in', [...ids, '5QwNhNMnKTx8fwTNBnBi'])));
console.log('docs3:', docs3.docs.map(doc => doc.id)); I get this output:
Maybe a firestore issue... Edit: Reproducing Firestore issue: https://github.com/ben12/firestore-issue |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed soon. Please update it or it may be closed to keep our repository organized. The best way is to add some more information or make a pull request with a test case. Also you might get help in fixing it at the RxDB Community Chat If you know you will continue working on this, just write any message to the issue (like "ping") to remove the stale tag. |
I am trying to implement this kind of rules in Firestore database (https://firebase.google.com/docs/firestore/security/insecure-rules#open_access):
In replication configuration I set filter to be conform with the rules:
But this do not work for data creation because push do a get by ids without the pull filter configuration.
Even though all documents returned by the query have the correct "author_uid", "resource.data.author_uid" is not the result of the query but the potential result obtained using the query criteria (https://firebase.google.com/docs/firestore/security/rules-conditions#rules_are_not_filters) :
So, using Firestore replication plugin, it is impossible to implement rules based on the values of the result data fields.
The text was updated successfully, but these errors were encountered: