Chapter 3: Ticket: Migration [Solved]

I’m getting error from this line:

for (Document doc : movies.find(myfilter1))…

com.mongodb.MongoQueryException: Query failed with error code 2 and error message ‘unknown top level operator: $match’ on server localhost:27017

I tried both filter parameter but getting same error:

Bson dateStringFilter = match(type("lastupdated", "string"));

Document myfilter1 = new Document("$match", 
    new Document("lastupdated", new Document("$type", "string")));

any body encountered this?

Please disregard. I found the solution.

1 Like