Consider the following schema:
const mySchema = schema(
{
foo: Types.string(),
bar: Types.string()
});
const MyModel = papr.model('mymodels', mySchema);
Now consider some code that queries this model:
const t = MyModel.find(
{ foo: 'baz' },
{
projection: {
foo: 1,
unknown: 1
}
}
);
Currently this projection type will not produce a TS error even though it is projecting properties that do not exist on the schema. This can be problematic in applications, especially because it will not flag misspelled properties (an issue we ran into recently)
Consider the following schema:
Now consider some code that queries this model:
Currently this projection type will not produce a TS error even though it is projecting properties that do not exist on the schema. This can be problematic in applications, especially because it will not flag misspelled properties (an issue we ran into recently)