kajnes
9/19/2017 - 5:34 PM

MONGOOSE/MODEL CONFIG (Node App)

MONGOOSE/MODEL CONFIG (Node App)

// MONGOOSE/MODEL CONFIG
var blogSchema = new mongoose.Schema({
title: String,
lead: String,
//image: {type: String, default: "blank_image.jpg"},
image: String,
body: String,
category: {type: String, default: "Informacje"},
keywords: String,
slug: { type: String, index: { unique: true } },
created: {type: Date, default: Date.now}
    
});


var Blog = mongoose.model("Blog", blogSchema);

//Debug - create one blog post
Blog.create({
    title: "Test blog title",
    lead: "lead test",
    image: "https://media.gcflearnfree.org/content/55e0730c7dd48174331f5164_01_17_2014/desktop_full_view_alt.jpg",
    body: "A computer is a device that can be instructed to carry out arbitrary sequences of arithmetic or logical operations automatically. The ability of computers to follow generalized sets of operations, called programs, enables them to perform an extremely wide range of tasks.",
    category: "Technologia",
    keywords: "komputer, technologia"
});