Driver setup and Projection

I did not understand the Ticket:Projection question

Please elaborate the confusion.


i am facing issue on projection status i get this message(The return from the api was incorrect when searching by country) . result was fetch in console from MoviesDAO.js, and from moviescontroller.js , the expected result but from staus can get the result from api

My Code : static async getMoviesByCountry(country) {

let cursor
try {
  // TODO Ticket: Projection
  // Find movies matching the "countries" list, but only return the title
  // and _id. Do not put a limit in your own implementation, the limit
  // here is only included to avoid sending 46000 documents down the
  // wire.

  cursor = await movies.find({
    { projection: { title: 1 } }

} catch (e) {
  console.error(`Unable to issue find command, ${e}`)
  return []

return cursor.toArray();

Hi @Let_Us_Programming, welcome to the community.
Your projection looks good to me.
But please note there is no such variable as country in the getMoviesByCountry method. I believe you have changed the argument from countries to country. Please note that the argument in the function is expecting an array of countries and you have to use the $in operator to find the documents having country as one of those mentioned in the countries array.

I hope it helps.

In case you have any doubts, please feel free to reach out to us.

Thanks and Regards.
Sourabh Bagrecha,
Curriculum Services Engineer

In addition do not forget about :