Node js如何从get请求读取参数

i'm trying to write a get request with node js the classic get request send all data base as res.json and as you see in the data base code imei.name take a value every time and i want to write a get methode to have only a special imei.name get methode in a res.json

router.get('/gettdata', (req, res, next) => {
    Post.find()
        .then((posts) => {
            res.json(posts);
            console.log(posts);
            console.log("ok" + JSON.stringify(req.body) + req.body.imei);
        })
        .catch(err => console.log(err))
});

这是我要更改的get方法,如您所见,有数据库

{
        "_id" : ObjectId("5eb7f90fb88d8d4d94184333"),
        "imei" : {
                "name" : "bokhhjbr",
                "modele" : "5486"
        },
        "__v" : 0
}
{
        "_id" : ObjectId("5eb7fb9cb88d8d4d94184334"),
        "imei" : {
                "name" : "865566048694354",
                "modele" : "CPH1803"
        },
        "__v" : 0
}

有关更多信息,您可以添加一些评论,我需要任何帮助,谢谢

评论