Skip to content

Commit cc622fc

Browse files
authored
Add warning message when passing DcoumentReference in cursor (#1883)
1 parent ac35b37 commit cc622fc

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

dev/src/reference.ts

+9
Original file line numberDiff line numberDiff line change
@@ -1845,6 +1845,15 @@ export class Query<T = firestore.DocumentData> implements firestore.Query<T> {
18451845
return this._queryOptions.fieldOrders;
18461846
}
18471847

1848+
// TODO(b/296435819): Remove this warning message.
1849+
if (cursorValuesOrDocumentSnapshot[0] instanceof DocumentReference) {
1850+
// eslint-disable-next-line no-console
1851+
console.warn(
1852+
`Warning: Passing DocumentReference into a cursor without orderBy clause is not an intended
1853+
behavior. Please use DocumentSnapshot or add an explicit orderBy on document key field.`
1854+
);
1855+
}
1856+
18481857
const fieldOrders = this._queryOptions.fieldOrders.slice();
18491858

18501859
// If no explicit ordering is specified, use the first inequality to

0 commit comments

Comments
 (0)