I'm writing a music organization app with the latest version of Meteor (A new web framework.). I think that the best way to store playlists is to put each playlist in a document and put the items of the playlist in array inside the document. It looks something like this:
{
"name": "a very cool playlist"
"items: [
{"audioFileID": 144}
{"audioFileID": 443}
{"audioFileID": 035}
{"audioFileID": 442}
]
}
My problem is that that minimongo (Meteor's pure javascript MongoDB implementation) only supports MongoDB 2.4. That means I can't use the $position
operator to insert a playlist element in the middle of the playlist. What's the best way to get around this? I can't believe that nobody had a way to insert items into the middle of an array before MongoDB 2.6. Or maybe there's a way to easily patch minimongo.