I'm having troubles finding a way to execute the following mongo text search:
I have a phrase: "I like apples" and I want to search if my messages collection already has this exact phrase in the content parameter of the collection but only in the last 5 entries. Is this possible to do? I tried something like this but I think it is applying the query to all the entries in the collection:
results = (
self.message_collection..find(
{"$text": {"$search": escaped_message}},
)
.sort("created_at", -1)
.limit(5)
)