FAIL test/projection.test.js

static async getMoviesByCountry(countries) {
let cursor
try {
cursor = await movies.find({
countries: {
in: countries } }).project({ title: 1 })​ cursor = await movies.find().limit(1) } catch (e) { console.error(`Unable to issue find command, {e}`)
return
}
return cursor.toArray()
}

remove

cursor = await movies.find().limit(1)

still its not working
getting error as : Unexpected character ‘​’

Code is:

static async getMoviesByCountry(countries) {
let cursor
try {
cursor = await movies.find({
countries: {
in: countries
}
}).project({
title: 1
})​
} catch (e) {
console.error(Unable to issue find command, ${e})
return
}
return cursor.toArray()
}

remove await and try this statements

>  { countries: { $in: countries } },
    { projection: { title: 1, _id: 1 } }

following are the code and attached is the error pic
static async getMoviesByCountry(countries) {
let cursor
try {
cursor = {
countries: {
in: countries } }, { projection: { title: 1, _id: 1 } } } catch (e) { console.error(`Unable to issue find command, {e}`)
return
}
return cursor.toArray()
}

u should put $in see below how it is done

i did as u mentioned , but still having same issue as the above image on line 72. in return cusrsor.toArray().

hey @VIKASH_74762 where the function name …

cursor = movies.find( inside this use the statement i already mentioned.)

mycode this is my code for which i getting the above error

@VIKASH_74762 let ,me know if your still getting the same error.

yes @MANJESHA_34722 , i am getting the same above error in line 72

have you change this
https://discourse.university.mongodb.com/t/fail-test-projection-test-js/33036/8?u=manjesha_34722

No, i did not changes. my code is as the image.

do changes to ur code as per this
https://discourse.university.mongodb.com/t/fail-test-projection-test-js/33036/8?u=manjesha_34722

i am sending u my code which i am using now with screenshotcode12

error screenshot

image

go through it.

can you plz send me the screenshot of ur code.
please

@VIKASH_74762 let me know ur still facing issues in that

thank you so much @MANJESHA_34722. it worked