data = dict((key, request.form.getlist(key) if len(request.form.getlist(key
    )) > 1 else request.form.getlist(key)[0]) for key in list(request.form.keys()))
In Flask convert form POST object into a representation suitable for mongodb