开发者

Insert & save with mongoose collection

I am trying to insert new records in开发者_C百科to my MongoDB using Mongoose. I have the following coffeescript, iterating over an array of ad_units:

campaign_doc = new mongoose.Collection 'scheduled_campaigns', db
for unit in ad_units
campaign = new campaign_model unit
campaign_doc.insert campaign
campaign.save()

The code runs and no errors are thrown. However, my collection is not updated.

Any ideas?

Thanks, Igor


I resolved my issue: it was a connection problem. The code in fact works, I just had to run it from a different server.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜