feathersjs / feathers

The API and real-time application framework
https://feathersjs.com
MIT License
15.07k stars 752 forks source link

can i $populate and find data inside the populate and return only that data after query ? #2957

Closed dike321 closed 1 year ago

dike321 commented 1 year ago
{
    "total": 2,
    "limit": 10,
    "skip": 0,
    "data": [
        {
            "_id": "62f4d8cf2994171830bf2e79",
            "trailerNumber": {
                "_id": "62f4d8cf2994171830bf2e65",
                "licenceStatus": true,
                "deleted": true
            }
        },{
            "_id": "62f4d9642994171830bf34d2",
            "trailerNumber": {
                "_id": "62f4d9642994171830bf34be",
                "licenceStatus": true,
                "deleted": false
            }
        }
    ]
}

i try using this query

ctx.params.query.$populate = [{
    path: 'trailerNumber',
    match: { deleted: false },
}]

it will return null for trailerNumber deleted: true, not removed the data. i don't want using aggregate