@ramanjaneya_karnati you’ll likely need to trace the caller of getMovieFilterQuery to see how the function result is being passed to a query, but given the error you shared you’re likely sending a command similar to the following to the server:

db.foo.find({ $in: [ 'movie1', 'movie2' ] })

The server is expecting you to send:

db.foo.find({ movieId: { $in: [ 'movie1', 'movie2' ] }})

Stepping through your logic should surface the issue pretty quickly.

2 Likes