Created
September 19, 2018 20:16
-
-
Save Sampath-Lokuge/b0f4e2505da0403f6704ecf369bb6505 to your computer and use it in GitHub Desktop.
models
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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