My Use case
I have a playlist for an online music player. Currently they sorted by natural order when they are displayed.
I would like to put in a field for a track position within a playlist.
What would be the best way to implement this for a collection in meteor mongo db.
Here is my current schema for my Songs collection.
//Schema for Songs
Schema.Songs = new SimpleSchema({
trackId: {
type: String,
label: "Track ID",
optional: false
},
title: {
type: String,
label: "Name",
optional: false
},
duration:{
type: Number,
label: "Duration",
optional: false
},
festivalId: {
type: SimpleSchema.RegEx.Id,
optional: false
}
});
I would like to be able to reorder the songs, for example a song at position 3. I would like to move it to position 1 and then all other songs position field would update appropriately .
What would be a good starting point for this?