I'm using flask and pymongo to create a website, but my database has some problems.
I want to display the 3 most recent keys (most recent uploads) first but I can't figure out how.
@app.route("/")
def slash():
data = music.find({},{"_id":-1})
return render_template("index.html", artists=data)
Thanks in advance, been stuck on this for awhile.
I tried to get the top 3 keys to be in decending order
_id: 3,
_id: 2,
_id: 1
instead alot of errors happened and when i tried using sorted it just outputted
_id: 1,
_id: 2,
_id: 3