I use feathersjs v 5.0.8 with TypeBox for mongoDB schema. In my schema I have a nested json object after which I'm doing finding data. I added additional special query to schema in this way:
[
querySyntax(messageQueryProperties),
// Add additional query properties here
Type.Object({'businessRegisterEntityID.NIP': Type.String()}),
Type.Object({})
]
when my query is like this: { query: { 'businessRegisterEntityID.NIP': 1234567890 }} the app is working correctly but when my query not contain businessRegisterEntityID.NIP field, then I receive an error:
error: Data: [
{
instancePath: '',
schemaPath: '#/required',
keyword: 'required',
params: { missingProperty: 'businessRegisterEntityID.NIP' },
message: "must have required property 'businessRegisterEntityID.NIP'"
]
I want searching a data by empty query like this: { query: {}} and after nested object like this: { query: { 'businessRegisterEntityID.NIP': 1234567890 }}
How to prepare TypeBox mongoDB schema with additional special query?