@@ -82,4 +82,20 @@ All cursor modules provide, at least, two functions:
8282For document-based modules, these functions can only fail with a ` MongoError ` , while for schema-based modules, they can
8383fail also with a ` ParseError ` . For this reason, the schema-based modules provide two additional functions:
8484` toArrayEither ` and ` toStreamEither ` . These functions return, respectively, an array and a stream of ` Either ` s, allowing
85- the code to process all the documents, even if some of them are invalid.
85+ the code to process all the documents, even if some of them are invalid.
86+
87+ ## Known limitations
88+
89+ ### Filters for Schema-based operations
90+
91+ Using ` Filter ` in schema-based operations (e.g. ` find ` , ` deleteOne ` , etc.) is not as straightforward as in
92+ document-based operations.
93+ Given a ` Schema<A, I, R> ` , ` A ` is the runtime/decoded type of the documents, while ` I ` is the persisted/encoded type of
94+ the same documents.
95+ Therefore, to filter documents in MongoDB, the client must provide a filter of type ` Filter<I> ` , where ` Filter ` is the
96+ type provided by the MongoDB driver.
97+
98+ A better approach, given the design of the Schema-based operations, would be to provide filters as ` Filter<A> ` , but
99+ we didn't yet find a straightforward way to map ` Filter<A> ` to ` Filter<I> ` .
100+ For this reason, we decided to keep the original MongoDB filter type.
101+ In the future, this may (hopefully) change.
0 commit comments