These are chat archives for Automattic/mongoose

19th
Apr 2015
Alex Hatzipanis
@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
@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: http://pastebin.com/Mgm0ARNH 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
@christiannwamba
Apr 19 2015 20:10

Hi!
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:

Todo.add(req.body);

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
Chris