Skip to content

Commit 334b266

Browse files
authored
fix(firestore): Read user data from pipeline in union stage (#9765)
1 parent 4e99d4b commit 334b266

4 files changed

Lines changed: 64 additions & 0 deletions

File tree

.changeset/stupid-turtles-grow.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@firebase/firestore': patch
3+
---
4+
5+
Read user data from pipeline in union stage. Fixes [GitHub Issue #9764](https://github.com/firebase/firebase-js-sdk/issues/9764)

packages/firestore/src/lite-api/stage.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -626,6 +626,7 @@ export class Union extends Stage {
626626
}
627627

628628
_readUserData(context: ParseContext): void {
629+
this.other._readUserData(context);
629630
super._readUserData(context);
630631
}
631632
}

packages/firestore/test/integration/api/pipeline.test.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1910,6 +1910,35 @@ apiDescribe.skipClassic('Pipelines', persistence => {
19101910
);
19111911
});
19121912

1913+
it('run pipeline with user data with union', async () => {
1914+
const snapshot = await execute(
1915+
firestore
1916+
.pipeline()
1917+
.collection(randomCol.path)
1918+
.union(
1919+
firestore
1920+
.pipeline()
1921+
.collection(randomCol.path)
1922+
.where(equal('title', "The Hitchhiker's Guide to the Galaxy"))
1923+
)
1924+
.sort(field(documentIdFieldPath()).ascending())
1925+
);
1926+
expectResults(
1927+
snapshot,
1928+
'book1',
1929+
'book1',
1930+
'book10',
1931+
'book2',
1932+
'book3',
1933+
'book4',
1934+
'book5',
1935+
'book6',
1936+
'book7',
1937+
'book8',
1938+
'book9'
1939+
);
1940+
});
1941+
19131942
it('supports options', async () => {
19141943
const snapshot = await execute(
19151944
firestore

packages/firestore/test/lite/pipeline.test.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1898,6 +1898,35 @@ describe.skipClassic('Firestore Pipelines', () => {
18981898
);
18991899
});
19001900

1901+
it('run pipeline with user data with union', async () => {
1902+
const snapshot = await execute(
1903+
firestore
1904+
.pipeline()
1905+
.collection(randomCol.path)
1906+
.union(
1907+
firestore
1908+
.pipeline()
1909+
.collection(randomCol.path)
1910+
.where(equal('title', "The Hitchhiker's Guide to the Galaxy"))
1911+
)
1912+
.sort(field(documentIdFieldPath()).ascending())
1913+
);
1914+
expectResults(
1915+
snapshot,
1916+
'book1',
1917+
'book1',
1918+
'book10',
1919+
'book2',
1920+
'book3',
1921+
'book4',
1922+
'book5',
1923+
'book6',
1924+
'book7',
1925+
'book8',
1926+
'book9'
1927+
);
1928+
});
1929+
19011930
it('supports options', async () => {
19021931
const snapshot = await execute(
19031932
firestore

0 commit comments

Comments
 (0)