This repository has been archived on 2026-05-01. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
PolyNotFound/models/database/playlists.model.js
2021-12-22 11:09:20 +01:00

24 lines
471 B
JavaScript

module.exports = mongoose => {
let schema = mongoose.Schema({
userId: String,
videoIds: {
type: Array,
default: []
},
name: String,
isActive: {
type: Boolean,
default: true
}
},
{ timestamps: true }
);
schema.method("toJSON", function() {
const { __v, _id, ...object } = this.toObject();
object.id = _id;
return object;
});
return mongoose.model("playlists", schema);
};