Ticket: Subfield Text Search

In this ticket, we are supposed to implement the MovieDao.getMoviesByCast() method.

I took a look at the unit test TextAndSubfieldTest.testSearchMultipleCast(), it passes Elon Musk, Robert Redford, Julia Robert as cast.
But in my atlas cluster db sample_mflix, in collection movies; no movies are there with the cast members mentioned.

Please fix the unit test.

May be, like most unit tests, they create test documents for the duration of the test.

Nope, I checked the setup() method; it is using the sample_mflix.movies db; not a test db

May be using $all is not the appropriate operator.

Tried with $elemMatch. Same result.
Why don’t you check for yourself?
Create a new project, create a free shared cluster, load sample data, and then perform query.

But I did check. But not only at the unit test. I also check the implementation. And I saw:

Bson castFilter = Filters.in("cast", cast);

That is why I wrote:

I could have tell you which operator to use. But giving a straight answer without giving a chance to think is like giving a man a fish. That would feed him for the day. I prefer when the man learns to fish.

1 Like

Sorry, my mistake.
I thought all cast members need to be included. So, i used $and.