Actually the question in the title, how in Mongoose to find all the data that are associated with the user, whose id = 1? I found only the findOne () method in the official documentation, followed by listing the required fields, but I did not find how to take everything at once ...

  • one
    User.findOne({id: id}).exec().then(user=>console.log(user)); - vp_arth
  • 2
    @vp_arth dear sir, add your comment in response so that I can mark it as correct. Thank you very much. Works. - Bim Bam

1 answer 1

As you can see from the documentation , the list of fields is optional.

Just do not describe the list of fields at all:

 User.findOne({id: 1}).exec() // Получаем Promise .then(user=>console.log(user));