In a complicated paging process with next/previous pages, I retrieve an additional filter to insert into my initial query filter.
Document filter = filter(...);
filter = Filters.and(filter, new Document(req.getParameter("paging")));
List results = MongoDb.aggregate(new Document("$match", filter),
new Document("$limit", ...
"paging" is complete representation of a MongoDB filter ($and, $or ...) converted into a document.
Because I'm using $and I'm sure that the query will not get out of the first filter.
Please, is it really secure?