Skip to content Skip to sidebar Skip to footer

Cause Of Mongoengine.errors.invalidqueryerror

The journey with Flask, MongoDB and MongoEngine continues. I've (hopefully) synced up the database with my model in a normal fashion, yet when I attempt to query the database for s

Solution 1:

The cause of this error was actually surprisingly simple – the object was being retrieved correctly, but the Flask web application is not amenable to receiving pure JSON on the front end.

For some reason I expected it would print the JSON as a string, but that was not the case.

In order to get the desired outcome, one could call field names specifically (specific_person.name) or using Flask's render_template functionality to format the output nicely on a webpage.

Solution 2:

I know it's VERY late but might help someone else. you can do something like:

return jsonify(bingo=bingo)

Don't forget to import jsonify though.

Post a Comment for "Cause Of Mongoengine.errors.invalidqueryerror"