Skip to content

Commit 20a7270

Browse files
Add documentID()
1 parent 505792f commit 20a7270

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

packages/firestore/lite/index.node.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ export {
3939

4040
export { FieldPath } from './src/api/field_path';
4141

42+
// TOOD(firestorelite): Add tests when Queries are usable
43+
export { documentId } from './src/api/field_path';
44+
4245
export { DocumentSnapshot, QueryDocumentSnapshot } from './src/api/snapshot';
4346

4447
export function registerFirestore(): void {

packages/firestore/lite/src/api/field_path.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@
1818
import * as firestore from '../../index';
1919

2020
import { tryCast } from './util';
21-
import { FieldPath as InternalFieldPath } from '../../../src/model/path';
21+
import {
22+
DOCUMENT_KEY_NAME,
23+
FieldPath as InternalFieldPath
24+
} from '../../../src/model/path';
2225
import { validateNamedArrayAtLeastNumberOfElements } from '../../../src/util/input_validation';
2326
import { Code, FirestoreError } from '../../../src/util/error';
2427

@@ -69,3 +72,7 @@ export class FieldPath implements firestore.FieldPath {
6972
return this._internalPath.isEqual(path._internalPath);
7073
}
7174
}
75+
76+
export function documentId(): firestore.FieldPath {
77+
return new FieldPath(DOCUMENT_KEY_NAME);
78+
}

0 commit comments

Comments
 (0)