The Error Message is : Error: Only $and, $or and $not can only be used as root level operators. Found $in.
at processWhere (/home/shivam.sharma/Projects/inno-ricemill-app/node_modules/@strapi/database/dist/index.js:3509:13)
at processNested (/home/shivam.sharma/Projects/inno-ricemill-app/node_modules/@strapi/database/dist/index.js:3486:10)
at processWhere (/home/shivam.sharma/Projects/inno-ricemill-app/node_modules/@strapi/database/dist/index.js:3524:25)
at processNested (/home/shivam.sharma/Projects/inno-ricemill-app/node_modules/@strapi/database/dist/index.js:3486:10)
at /home/shivam.sharma/Projects/inno-ricemill-app/node_modules/@strapi/database/dist/index.js:3501:41
at Array.map ()
at processWhere (/home/shivam.sharma/Projects/inno-ricemill-app/node_modules/@strapi/database/dist/index.js:3501:28)
at /home/shivam.sharma/Projects/inno-ricemill-app/node_modules/@strapi/database/dist/index.js:3493:31
at Array.map ()
at processWhere (/home/shivam.sharma/Projects/inno-ricemill-app/node_modules/@strapi/database/dist/index.js:3493:18)
at Object.processState (/home/shivam.sharma/Projects/inno-ricemill-app/node_modules/@strapi/database/dist/index.js:4114:21)
at Object.getKnexQuery (/home/shivam.sharma/Projects/inno-ricemill-app/node_modules/@strapi/database/dist/index.js:4146:12)
at Object.execute (/home/shivam.sharma/Projects/inno-ricemill-app/node_modules/@strapi/database/dist/index.js:4243:25)
at Object.findMany (/home/shivam.sharma/Projects/inno-ricemill-app/node_modules/@strapi/database/dist/index.js:5003:70)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Promise.all (index 0)
[2024-08-09 17:19:38.959] http: POST /api/custom/getIDOMultiRowSingleColSEARCHEntityService (21 ms) 404
this can be handled in strapi using one trick in filters section
const fil_arr=;
DO?fil_arr.push({
DO: {
$in: DO,
}
}):null;
GPC?fil_arr.push({
GovermentPaddyCenter: {
$in: GPC,
},
}):null;
TN?TN.map(x=>({Truck:{TruckNumber:x}})).map(x=>{fil_arr.push(x)}):null;
GP?GP.map(x=>({Truck:{Gate:{GatePass:x}}})).map(x=>{fil_arr.push(x)}):null;
// return fil_arr
console.log(‘fil_arr’,fil_arr);
const get_ido = await strapi.entityService.findPage('api::ido.ido',{
page:1,
pageSize:20,
sort: { id: 'DESC' },
filters:{
$or: fil_arr
},
populate: {
'Truck':{
populate:{
'Gate':true
}
},
'Paddy':{
populate:{
'paddy_variety':{
select:['id','Name']
}
}
}
},
});
by this we can deep search insidea component with same feature as of $in inside a component