private Queue<Map<Object, Object>> collectConnectorArgs(String operator, Operation<?> operation) {

        Queue<Map<Object, Object>> pendingDocuments = new LinkedList<Map<Object, Object>>();
        for (Expression<?> exp : operation.getArgs()) {
            Map<Object, Object> document = (Map<Object, Object>) handle(exp);
            if (document.keySet().size() == 1 && document.containsKey(operator)) {
                pendingDocuments
                        .addAll((Collection<Map<Object, Object>>) document.get(operator));
            } else {
                pendingDocuments.add(document);
            }
        }
        return pendingDocuments;
    }
Serializes the given Querydsl query to a Document query for MongoDB.

@author Mark Paluch
querydsl-mongodb/src/main/java/com/querydsl/mongodb/document/MongodbDocumentSerializer.java