【问题标题】:Insert & save with mongoose collection使用 mongoose 集合插入和保存
【发布时间】:2011-11-07 00:08:10
【问题描述】:

我正在尝试使用 Mongoose 将新记录插入我的 MongoDB。我有以下咖啡脚本,遍历 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()

代码运行并且没有抛出错误。但是,我的收藏没有更新。
有什么想法吗?

谢谢, 伊戈尔

【问题讨论】:

    标签: mongodb coffeescript mongoose


    【解决方案1】:

    我解决了我的问题:这是一个连接问题。代码实际上是有效的,我只需要从不同的服务器上运行它。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-03-29
      • 1970-01-01
      • 2020-01-19
      • 2018-03-24
      • 2012-11-04
      • 1970-01-01
      • 1970-01-01
      • 2021-01-30
      相关资源
      最近更新 更多