protected Document createProjection(Expression<?> projection) {
        if (projection instanceof FactoryExpression) {
            Document obj = new Document();
            for (Object expr : ((FactoryExpression) projection).getArgs()) {
                if (expr instanceof Expression) {
                    obj.put((String) serializer.handle((Expression) expr), 1);
                }
            }
            return obj;
        }
        return null;
    }
Define a constraint for an embedded object

@param collection collection
@param target target
@return builder
querydsl-mongodb/src/main/java/com/querydsl/mongodb/document/AbstractMongodbQuery.java