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.
精彩评论