Sort Sub Documents in MongoDB

Gibt es eine Möglichkeit, Unterdokumente in einer Mongo-Abfrage zu sortieren? Beispiel (Blog-Sammlung):

{
    "_id" : ObjectId("4c69d19532f73ad544000001"),
    "content" : "blah blah blah",
        "comments" : {
{"author": "jim",   "content":"comment content 1", "date" : "07-24-1995"},
{"author": "joe",   "content":"comment content 2",  "date" : "07-24-1996"}
{"author": "amy", "content":"comment content 3", "date" : "09-10-1999"}
        }
}
{
    "_id" : ObjectId("4c69d19532f73ad544000002"),
    "content" : "blah blah blah",
        "comments" : {
{"author": "jim",   "content":"comment content 1",  "date" : "07-24-1995"},
{"author": "joe",   "content":"comment content 2",  "date" : "07-24-1996"}
{"author": "amy", "content":"comment content 3",  "date" : "07-24-1997"}
        }
}

Ich möchte, dass meine Blogposts so sortiert werden, wie ich es möchte. Anschließend werden die Kommentare in meinen Blogposts in umgekehrter Reihenfolge nach Datum oder nach einer anderen von mir gewünschten Sortierung sortiert. Ist das mit mongoDB möglich?

Antworten auf die Frage(6)

Ihre Antwort auf die Frage