Node.js + MongoDB - findOne() return one field not working

后端 未结 1 1159
遥遥无期
遥遥无期 2021-01-17 22:52

Why can I not be able to return only one field using \"findOne()\"? In the code below, all fields are returned. I also tried \"find()\", but still not working. Can someone t

1条回答
  •  离开以前
    2021-01-17 23:25

    You are not using the projection option:

    {projection: { info: true }}

    The way you are doing

    {info:1}

    It means you are requesting to use an index on info (if it exist)

    0 讨论(0)
提交回复
热议问题