Skip to content

Commit 85b7911

Browse files
committed
Add Condition query types to root property filters
The earlier type (`Partial<TSchema>`) would allow queries for exact matches, but didn't cover any of the richer query semantics such as operators or searching arrays by value. Previously, type tests covering the application of these richer query types were spuriously passing because of a comparison to the BSON `Document` type, which is `{ [key: string]: any }`. This change fixes the bulk of test failures that were introduced by the parent commit.
1 parent e138f8f commit 85b7911

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/mongo_types.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,9 @@ export type WithoutId<TSchema> = Omit<TSchema, '_id'>;
6666

6767
/** A MongoDB filter can be some portion of the schema or a set of operators @public */
6868
export type Filter<TSchema> =
69-
| Partial<TSchema>
69+
| Partial<{
70+
[Property in keyof TSchema]: Condition<TSchema[Property]>;
71+
}>
7072
| ({
7173
[Property in Join<NestedPaths<WithId<TSchema>>, '.'>]?: Condition<
7274
PropertyType<WithId<TSchema>, Property>

0 commit comments

Comments
 (0)