Skip to content

Commit e11a780

Browse files
committed
Adding Count to be accessible to the console.
1 parent de32c24 commit e11a780

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

packages/firestore-compat/src/index.console.ts

+14-1
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,11 @@ import {
2222
Firestore as FirestoreExp,
2323
FirestoreError,
2424
_EmptyAuthCredentialsProvider,
25-
_EmptyAppCheckTokenProvider
25+
_EmptyAppCheckTokenProvider,
26+
Query as ExpQuery,
27+
getCountFromServer
2628
} from '@firebase/firestore';
29+
import { Compat } from '@firebase/util';
2730

2831
import {
2932
Firestore as FirestoreCompat,
@@ -98,6 +101,16 @@ export class Firestore extends FirestoreCompat {
98101
new MemoryPersistenceProvider()
99102
);
100103
}
104+
105+
INTERNAL = {
106+
delete: () => this.terminate(),
107+
count: (query: Compat<ExpQuery<unknown>>) => {
108+
return getCountFromServer(query._delegate)
109+
.then(response => {
110+
return response.data().count;
111+
});
112+
}
113+
};
101114
}
102115

103116
function databaseIdFromFirestoreDatabase(

0 commit comments

Comments
 (0)