node.js - Mongo Creating parent schema with empty array of children -


i have following post schema array of comments.

jsfiddle

var newpost = new post({             title: req.body.title,             date: date.now(),             body: req.body.body,             image: req.body.image,             comments: {}         })         newpost.save(function(err){....) 

i trying create post, add database no comments yet. (comments added later when user going comment). tried null, {}, nothing works :(

ok figured out, wanted create post empty array of comments had was:

var newpost = new post({         title: req.body.title,         date: date.now(),         body: req.body.body,         image: req.body.image,         comments: []     })     newpost.save(function(err){....) 

Comments

Popular posts from this blog

neo4j - finding mutual friends in a cypher statement starting with three or more persons -

php - How to remove letter in front of the word laravel -

minify - Minimizing css files -