Text and Subfield Search: Did not receive the proper response when searching by genre

the test is running successfully but the UI is failing? what can be the problem, i searched other similar topics but i still couldn’t resolve my problem.

Which test you are referring to?
What error you are getting
Please make sure you are connected to the right cluster and the genre field/column exists in the collection you are querying

genreSearchQuery search, the error is as mentioned in the topic, i am getting this error on the UI, but the text-subfield.test is successfully passing.

Hi @Nabeel_shah_26520,

I am moving this thread to the M220JS forum. @kanikasingla will look into it.

Thanks,
Shubham Ranjan
Curriculum Support Engineer

Hi @Nabeel_shah_26520,

Please check the terminal for any error message. And can you share the code changes you have done for the ticket?

Kanika

below is the ticket code

static genreSearchQuery(genre) {
const searchGenre = Array.isArray(genre) ? genre : genre.split(", ")
const query = {genres: {$in:searchGenre}}
const project = {_id:1,plot:1,genres:1,runtime:1,cast:1,num_mflix_comments:1,title:1,fullplot:1,countries:1,released:1,directors:1,rated:1,awards:1,lastupdated:1,year:1,imdb:1,type:1,tomatoes:1}
const sort = DEFAULT_SORT
return { query, project, sort }

1 Like

this is the log statements of npm start
(node:14068) DeprecationWarning: current Server Discovery and Monitoring engine is deprecated, and will be removed in a future version. To use the new Server Discover and Monitoring engine, pass option { useUnifiedTopology: true } to MongoClient.connect.
listening on port 5000
GET /status/ 304 9.400 ms - -
GET /static/css/main.d2c98b4b.chunk.css 304 1.518 ms - -
GET /static/js/1.18f02ebe.chunk.js 304 3.321 ms - -
GET /static/js/main.a01f0687.chunk.js 304 5.472 ms - -
GET /static/media/mongoleaf.0ebc1843.png 304 1.076 ms - -
GET /static/media/pixelatedLeaf.6c93bd20.svg 304 0.865 ms - -
GET /manifest.json 304 1.059 ms - -
GET /api/v1/movies/search?cast=Kevin%20Connolly 304 270.977 ms - -
GET /api/v1/movies/search?text=shawshank 304 203.971 ms - -
GET /api/v1/movies/search?genre=Talk-Show 200 267.491 ms - 1668

The ticket is expecting all of the fields in projection. Please check with the movies database. One way is if we pass nothing to project object, it will return all the fields.

Kanika

1 Like

thanks a lot, it works now.

1 Like