Skip to content

Instantly share code, notes, and snippets.

@Sampath-Lokuge
Created September 19, 2018 20:16
Show Gist options
  • Save Sampath-Lokuge/b0f4e2505da0403f6704ecf369bb6505 to your computer and use it in GitHub Desktop.
Save Sampath-Lokuge/b0f4e2505da0403f6704ecf369bb6505 to your computer and use it in GitHub Desktop.
models
const mongoose = require("mongoose");
const PlaylistSchema = new mongoose.Schema({
playlists: [{
listId: String,
title: String,
playlist_item_count: Number,
sortOrder: Number,
videoDetails: [
{
short_description: String,
vimeo_id: String,
title: String,
duration: Number,
posterImage: String,
videoId: String,
presentedBy: String,
customFields: {},
audioURL: String,
accessLevel: {
type: String,
enum: ["public", "premium"],
default: "public"
}
},
],
isPrimary: {
type: Boolean,
default: false
}
}]
}, { usePushEach: true });
PlaylistSchema.set("toJSON", { virtuals: true });
PlaylistSchema.set("toObject", { virtuals: true });
module.exports = mongoose.model("Playlist", PlaylistSchema);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment