{ "Collection Group query": { "describeName": "Queries:", "itName": "Collection Group query", "tags": [ ], "config": { "numClients": 1, "useGarbageCollection": true }, "steps": [ { "userListen": { "query": { "filters": [ ], "orderBys": [ ], "path": "cg/1" }, "targetId": 2 }, "expectedState": { "activeTargets": { "2": { "queries": [ { "filters": [ ], "orderBys": [ ], "path": "cg/1" } ], "resumeToken": "" } } } }, { "watchAck": [ 2 ] }, { "watchEntity": { "docs": [ { "key": "cg/1", "options": { "hasCommittedMutations": false, "hasLocalMutations": false }, "value": { "val": 1 }, "version": 1000 } ], "targets": [ 2 ] } }, { "watchCurrent": [ [ 2 ], "resume-token-1000" ] }, { "watchSnapshot": { "targetIds": [ ], "version": 1000 }, "expectedSnapshotEvents": [ { "added": [ { "key": "cg/1", "options": { "hasCommittedMutations": false, "hasLocalMutations": false }, "value": { "val": 1 }, "version": 1000 } ], "errorCode": 0, "fromCache": false, "hasPendingWrites": false, "query": { "filters": [ ], "orderBys": [ ], "path": "cg/1" } } ] }, { "userListen": { "query": { "filters": [ ], "orderBys": [ ], "path": "cg/2" }, "targetId": 4 }, "expectedState": { "activeTargets": { "2": { "queries": [ { "filters": [ ], "orderBys": [ ], "path": "cg/1" } ], "resumeToken": "" }, "4": { "queries": [ { "filters": [ ], "orderBys": [ ], "path": "cg/2" } ], "resumeToken": "" } } } }, { "watchAck": [ 4 ] }, { "watchEntity": { "docs": [ { "key": "cg/2", "options": { "hasCommittedMutations": false, "hasLocalMutations": false }, "value": { "val": 2 }, "version": 1000 } ], "targets": [ 4 ] } }, { "watchCurrent": [ [ 4 ], "resume-token-1000" ] }, { "watchSnapshot": { "targetIds": [ ], "version": 1000 }, "expectedSnapshotEvents": [ { "added": [ { "key": "cg/2", "options": { "hasCommittedMutations": false, "hasLocalMutations": false }, "value": { "val": 2 }, "version": 1000 } ], "errorCode": 0, "fromCache": false, "hasPendingWrites": false, "query": { "filters": [ ], "orderBys": [ ], "path": "cg/2" } } ] }, { "userListen": { "query": { "filters": [ ], "orderBys": [ ], "path": "not-cg/nope/cg/3" }, "targetId": 6 }, "expectedState": { "activeTargets": { "2": { "queries": [ { "filters": [ ], "orderBys": [ ], "path": "cg/1" } ], "resumeToken": "" }, "4": { "queries": [ { "filters": [ ], "orderBys": [ ], "path": "cg/2" } ], "resumeToken": "" }, "6": { "queries": [ { "filters": [ ], "orderBys": [ ], "path": "not-cg/nope/cg/3" } ], "resumeToken": "" } } } }, { "watchAck": [ 6 ] }, { "watchEntity": { "docs": [ { "key": "not-cg/nope/cg/3", "options": { "hasCommittedMutations": false, "hasLocalMutations": false }, "value": { "val": 1 }, "version": 1000 } ], "targets": [ 6 ] } }, { "watchCurrent": [ [ 6 ], "resume-token-1000" ] }, { "watchSnapshot": { "targetIds": [ ], "version": 1000 }, "expectedSnapshotEvents": [ { "added": [ { "key": "not-cg/nope/cg/3", "options": { "hasCommittedMutations": false, "hasLocalMutations": false }, "value": { "val": 1 }, "version": 1000 } ], "errorCode": 0, "fromCache": false, "hasPendingWrites": false, "query": { "filters": [ ], "orderBys": [ ], "path": "not-cg/nope/cg/3" } } ] }, { "userListen": { "query": { "filters": [ ], "orderBys": [ ], "path": "not-cg/nope" }, "targetId": 8 }, "expectedState": { "activeTargets": { "2": { "queries": [ { "filters": [ ], "orderBys": [ ], "path": "cg/1" } ], "resumeToken": "" }, "4": { "queries": [ { "filters": [ ], "orderBys": [ ], "path": "cg/2" } ], "resumeToken": "" }, "6": { "queries": [ { "filters": [ ], "orderBys": [ ], "path": "not-cg/nope/cg/3" } ], "resumeToken": "" }, "8": { "queries": [ { "filters": [ ], "orderBys": [ ], "path": "not-cg/nope" } ], "resumeToken": "" } } } }, { "watchAck": [ 8 ] }, { "watchEntity": { "docs": [ { "key": "not-cg/nope", "options": { "hasCommittedMutations": false, "hasLocalMutations": false }, "value": { "val": 1 }, "version": 1000 } ], "targets": [ 8 ] } }, { "watchCurrent": [ [ 8 ], "resume-token-1000" ] }, { "watchSnapshot": { "targetIds": [ ], "version": 1000 }, "expectedSnapshotEvents": [ { "added": [ { "key": "not-cg/nope", "options": { "hasCommittedMutations": false, "hasLocalMutations": false }, "value": { "val": 1 }, "version": 1000 } ], "errorCode": 0, "fromCache": false, "hasPendingWrites": false, "query": { "filters": [ ], "orderBys": [ ], "path": "not-cg/nope" } } ] }, { "userListen": { "query": { "filters": [ ], "orderBys": [ ], "path": "cg/1/not-cg/nope" }, "targetId": 10 }, "expectedState": { "activeTargets": { "10": { "queries": [ { "filters": [ ], "orderBys": [ ], "path": "cg/1/not-cg/nope" } ], "resumeToken": "" }, "2": { "queries": [ { "filters": [ ], "orderBys": [ ], "path": "cg/1" } ], "resumeToken": "" }, "4": { "queries": [ { "filters": [ ], "orderBys": [ ], "path": "cg/2" } ], "resumeToken": "" }, "6": { "queries": [ { "filters": [ ], "orderBys": [ ], "path": "not-cg/nope/cg/3" } ], "resumeToken": "" }, "8": { "queries": [ { "filters": [ ], "orderBys": [ ], "path": "not-cg/nope" } ], "resumeToken": "" } } } }, { "watchAck": [ 10 ] }, { "watchEntity": { "docs": [ { "key": "cg/1/not-cg/nope", "options": { "hasCommittedMutations": false, "hasLocalMutations": false }, "value": { "val": 1 }, "version": 1000 } ], "targets": [ 10 ] } }, { "watchCurrent": [ [ 10 ], "resume-token-1000" ] }, { "watchSnapshot": { "targetIds": [ ], "version": 1000 }, "expectedSnapshotEvents": [ { "added": [ { "key": "cg/1/not-cg/nope", "options": { "hasCommittedMutations": false, "hasLocalMutations": false }, "value": { "val": 1 }, "version": 1000 } ], "errorCode": 0, "fromCache": false, "hasPendingWrites": false, "query": { "filters": [ ], "orderBys": [ ], "path": "cg/1/not-cg/nope" } } ] }, { "userListen": { "query": { "collectionGroup": "cg", "filters": [ ], "orderBys": [ ], "path": "" }, "targetId": 12 }, "expectedSnapshotEvents": [ { "added": [ { "key": "cg/1", "options": { "hasCommittedMutations": false, "hasLocalMutations": false }, "value": { "val": 1 }, "version": 1000 }, { "key": "cg/2", "options": { "hasCommittedMutations": false, "hasLocalMutations": false }, "value": { "val": 2 }, "version": 1000 }, { "key": "not-cg/nope/cg/3", "options": { "hasCommittedMutations": false, "hasLocalMutations": false }, "value": { "val": 1 }, "version": 1000 } ], "errorCode": 0, "fromCache": true, "hasPendingWrites": false, "query": { "collectionGroup": "cg", "filters": [ ], "orderBys": [ ], "path": "" } } ], "expectedState": { "activeTargets": { "10": { "queries": [ { "filters": [ ], "orderBys": [ ], "path": "cg/1/not-cg/nope" } ], "resumeToken": "" }, "12": { "queries": [ { "collectionGroup": "cg", "filters": [ ], "orderBys": [ ], "path": "" } ], "resumeToken": "" }, "2": { "queries": [ { "filters": [ ], "orderBys": [ ], "path": "cg/1" } ], "resumeToken": "" }, "4": { "queries": [ { "filters": [ ], "orderBys": [ ], "path": "cg/2" } ], "resumeToken": "" }, "6": { "queries": [ { "filters": [ ], "orderBys": [ ], "path": "not-cg/nope/cg/3" } ], "resumeToken": "" }, "8": { "queries": [ { "filters": [ ], "orderBys": [ ], "path": "not-cg/nope" } ], "resumeToken": "" } } } }, { "userListen": { "query": { "collectionGroup": "cg", "filters": [ [ "val", "==", 1 ] ], "orderBys": [ ], "path": "" }, "targetId": 14 }, "expectedSnapshotEvents": [ { "added": [ { "key": "cg/1", "options": { "hasCommittedMutations": false, "hasLocalMutations": false }, "value": { "val": 1 }, "version": 1000 }, { "key": "not-cg/nope/cg/3", "options": { "hasCommittedMutations": false, "hasLocalMutations": false }, "value": { "val": 1 }, "version": 1000 } ], "errorCode": 0, "fromCache": true, "hasPendingWrites": false, "query": { "collectionGroup": "cg", "filters": [ [ "val", "==", 1 ] ], "orderBys": [ ], "path": "" } } ], "expectedState": { "activeTargets": { "10": { "queries": [ { "filters": [ ], "orderBys": [ ], "path": "cg/1/not-cg/nope" } ], "resumeToken": "" }, "12": { "queries": [ { "collectionGroup": "cg", "filters": [ ], "orderBys": [ ], "path": "" } ], "resumeToken": "" }, "14": { "queries": [ { "collectionGroup": "cg", "filters": [ [ "val", "==", 1 ] ], "orderBys": [ ], "path": "" } ], "resumeToken": "" }, "2": { "queries": [ { "filters": [ ], "orderBys": [ ], "path": "cg/1" } ], "resumeToken": "" }, "4": { "queries": [ { "filters": [ ], "orderBys": [ ], "path": "cg/2" } ], "resumeToken": "" }, "6": { "queries": [ { "filters": [ ], "orderBys": [ ], "path": "not-cg/nope/cg/3" } ], "resumeToken": "" }, "8": { "queries": [ { "filters": [ ], "orderBys": [ ], "path": "not-cg/nope" } ], "resumeToken": "" } } } } ] }, "Collection Group query with mutations": { "describeName": "Queries:", "itName": "Collection Group query with mutations", "tags": [ ], "config": { "numClients": 1, "useGarbageCollection": true }, "steps": [ { "userListen": { "query": { "filters": [ ], "orderBys": [ ], "path": "cg/1" }, "targetId": 2 }, "expectedState": { "activeTargets": { "2": { "queries": [ { "filters": [ ], "orderBys": [ ], "path": "cg/1" } ], "resumeToken": "" } } } }, { "watchAck": [ 2 ] }, { "watchEntity": { "docs": [ { "key": "cg/1", "options": { "hasCommittedMutations": false, "hasLocalMutations": false }, "value": { "val": 1 }, "version": 1000 } ], "targets": [ 2 ] } }, { "watchCurrent": [ [ 2 ], "resume-token-1000" ] }, { "watchSnapshot": { "targetIds": [ ], "version": 1000 }, "expectedSnapshotEvents": [ { "added": [ { "key": "cg/1", "options": { "hasCommittedMutations": false, "hasLocalMutations": false }, "value": { "val": 1 }, "version": 1000 } ], "errorCode": 0, "fromCache": false, "hasPendingWrites": false, "query": { "filters": [ ], "orderBys": [ ], "path": "cg/1" } } ] }, { "userListen": { "query": { "filters": [ ], "orderBys": [ ], "path": "not-cg/nope" }, "targetId": 4 }, "expectedState": { "activeTargets": { "2": { "queries": [ { "filters": [ ], "orderBys": [ ], "path": "cg/1" } ], "resumeToken": "" }, "4": { "queries": [ { "filters": [ ], "orderBys": [ ], "path": "not-cg/nope" } ], "resumeToken": "" } } } }, { "watchAck": [ 4 ] }, { "watchEntity": { "docs": [ { "key": "not-cg/nope", "options": { "hasCommittedMutations": false, "hasLocalMutations": false }, "value": { "val": 1 }, "version": 1000 } ], "targets": [ 4 ] } }, { "watchCurrent": [ [ 4 ], "resume-token-1000" ] }, { "watchSnapshot": { "targetIds": [ ], "version": 1000 }, "expectedSnapshotEvents": [ { "added": [ { "key": "not-cg/nope", "options": { "hasCommittedMutations": false, "hasLocalMutations": false }, "value": { "val": 1 }, "version": 1000 } ], "errorCode": 0, "fromCache": false, "hasPendingWrites": false, "query": { "filters": [ ], "orderBys": [ ], "path": "not-cg/nope" } } ] }, { "userSet": [ "cg/2", { "val": 2 } ] }, { "userSet": [ "not-cg/nope/cg/3", { "val": 1 } ] }, { "userSet": [ "not-cg2/nope", { "val": 1 } ] }, { "userListen": { "query": { "collectionGroup": "cg", "filters": [ ], "orderBys": [ ], "path": "" }, "targetId": 6 }, "expectedSnapshotEvents": [ { "added": [ { "key": "cg/1", "options": { "hasCommittedMutations": false, "hasLocalMutations": false }, "value": { "val": 1 }, "version": 1000 }, { "key": "cg/2", "options": { "hasCommittedMutations": false, "hasLocalMutations": true }, "value": { "val": 2 }, "version": 0 }, { "key": "not-cg/nope/cg/3", "options": { "hasCommittedMutations": false, "hasLocalMutations": true }, "value": { "val": 1 }, "version": 0 } ], "errorCode": 0, "fromCache": true, "hasPendingWrites": true, "query": { "collectionGroup": "cg", "filters": [ ], "orderBys": [ ], "path": "" } } ], "expectedState": { "activeTargets": { "2": { "queries": [ { "filters": [ ], "orderBys": [ ], "path": "cg/1" } ], "resumeToken": "" }, "4": { "queries": [ { "filters": [ ], "orderBys": [ ], "path": "not-cg/nope" } ], "resumeToken": "" }, "6": { "queries": [ { "collectionGroup": "cg", "filters": [ ], "orderBys": [ ], "path": "" } ], "resumeToken": "" } } } }, { "userListen": { "query": { "collectionGroup": "cg", "filters": [ [ "val", "==", 1 ] ], "orderBys": [ ], "path": "" }, "targetId": 8 }, "expectedSnapshotEvents": [ { "added": [ { "key": "cg/1", "options": { "hasCommittedMutations": false, "hasLocalMutations": false }, "value": { "val": 1 }, "version": 1000 }, { "key": "not-cg/nope/cg/3", "options": { "hasCommittedMutations": false, "hasLocalMutations": true }, "value": { "val": 1 }, "version": 0 } ], "errorCode": 0, "fromCache": true, "hasPendingWrites": true, "query": { "collectionGroup": "cg", "filters": [ [ "val", "==", 1 ] ], "orderBys": [ ], "path": "" } } ], "expectedState": { "activeTargets": { "2": { "queries": [ { "filters": [ ], "orderBys": [ ], "path": "cg/1" } ], "resumeToken": "" }, "4": { "queries": [ { "filters": [ ], "orderBys": [ ], "path": "not-cg/nope" } ], "resumeToken": "" }, "6": { "queries": [ { "collectionGroup": "cg", "filters": [ ], "orderBys": [ ], "path": "" } ], "resumeToken": "" }, "8": { "queries": [ { "collectionGroup": "cg", "filters": [ [ "val", "==", 1 ] ], "orderBys": [ ], "path": "" } ], "resumeToken": "" } } } } ] }, "Latency-compensated updates are included in query results": { "describeName": "Queries:", "itName": "Latency-compensated updates are included in query results", "tags": [ ], "config": { "numClients": 1, "useGarbageCollection": true }, "steps": [ { "userListen": { "query": { "filters": [ ], "orderBys": [ ], "path": "collection" }, "targetId": 2 }, "expectedState": { "activeTargets": { "2": { "queries": [ { "filters": [ ], "orderBys": [ ], "path": "collection" } ], "resumeToken": "" } } } }, { "watchAck": [ 2 ] }, { "watchEntity": { "docs": [ { "key": "collection/a", "options": { "hasCommittedMutations": false, "hasLocalMutations": false }, "value": { "match": false }, "version": 1000 } ], "targets": [ 2 ] } }, { "watchCurrent": [ [ 2 ], "resume-token-1000" ] }, { "watchSnapshot": { "targetIds": [ ], "version": 1000 }, "expectedSnapshotEvents": [ { "added": [ { "key": "collection/a", "options": { "hasCommittedMutations": false, "hasLocalMutations": false }, "value": { "match": false }, "version": 1000 } ], "errorCode": 0, "fromCache": false, "hasPendingWrites": false, "query": { "filters": [ ], "orderBys": [ ], "path": "collection" } } ] }, { "userPatch": [ "collection/a", { "match": true } ], "expectedSnapshotEvents": [ { "errorCode": 0, "fromCache": false, "hasPendingWrites": true, "modified": [ { "key": "collection/a", "options": { "hasCommittedMutations": false, "hasLocalMutations": true }, "value": { "match": true }, "version": 1000 } ], "query": { "filters": [ ], "orderBys": [ ], "path": "collection" } } ] }, { "userListen": { "query": { "filters": [ [ "match", "==", true ] ], "orderBys": [ ], "path": "collection" }, "targetId": 4 }, "expectedSnapshotEvents": [ { "added": [ { "key": "collection/a", "options": { "hasCommittedMutations": false, "hasLocalMutations": true }, "value": { "match": true }, "version": 1000 } ], "errorCode": 0, "fromCache": true, "hasPendingWrites": true, "query": { "filters": [ [ "match", "==", true ] ], "orderBys": [ ], "path": "collection" } } ], "expectedState": { "activeTargets": { "2": { "queries": [ { "filters": [ ], "orderBys": [ ], "path": "collection" } ], "resumeToken": "" }, "4": { "queries": [ { "filters": [ [ "match", "==", true ] ], "orderBys": [ ], "path": "collection" } ], "resumeToken": "" } } } } ] } }