How to get multiple JSON objects using nodejs and mongoose?

前端 未结 2 1201
小鲜肉
小鲜肉 2021-01-27 13:25

I want to get all the JSON objects having season:2008 or season:2009. For season field there are 2008,2009,2010,2011,2012,2013,2014,2015,2016 values.

2条回答
  •  Happy的楠姐
    2021-01-27 13:54

    Now your both the routes are identical...you have to make different routes for both queries... because queries does not know what is match_id and session... if you keep same name for the routes then query which is before in the code will be executed first

    change your both the routes

        app.get('/api/match_id/:match_id)
    
        app.get(/api/matches/:season)
    

提交回复
热议问题