How do I retrieve records in MongoDB with PyMongo based on Flask URL variables?

Solution 1
@app.route("/infrastructure/")
def get_infrastructure(infrastructure_type):
    infrastructure = db.infrastructure.find({'properties': {'type': {'primary': infrastructure_type}}}, projection = {"_id": False})
    return jsonify([resource for resource in infrastructure])
Solution 2
@app.route("/infrastructure/")
def get_infrastructure(infrastructure_type):
    infrastructure = db.infrastructure.find({'properties.type.primary': infrastructure_type}, projection = {"_id": False})
    return jsonify([resource for resource in infrastructure])