These are chat archives for Automattic/mongoose

Apr 2015
Alex Hatzipanis
Apr 19 2015 05:25
Does anyone know how I can check in Handlebars whether the following field and its children are empty? I can use {{#if links.facebook }} but I can't do {{#if links }} afaik. Any help would be appreciated.
"links" : {
        "facebook" : "",
        "googleplus" : "",
        "twitter" : "",
        "website" : ""
Dustin Lennon
Apr 19 2015 05:45
I'm having some issues trying to figure out what my culprit is that is generating an error I have pasted here: This error is generated when I run a curl request: curl -v -H "Content-Type: application/json" -XPOST --data "{\"username\":\"demonicp_eorzea\", \"body\":\"node rules!\"}" localhost:3000/api/posts
Christian Nwamba
Apr 19 2015 20:10

If I had a mongoose model Todo with the fields: item, done, time.
Is there an easy way to map objects from the client to it. That is, instead of
Todo.create({ item: req.body.item, done: req.body.done, data: new Date(), }, function (.........
I could simply do something we normally do with entity framework for ASP.Net devs:


So that if i had a very long set of fields I do not have to explicitly pass them to Todo model.

I also need that for Update actions.

Any idea please?

Thanks and Regards