0

我正在使用 Compoundjs 和 jugglingdb 从 Mongo 获取一些数据。在我的代码中,我有以下内容

 Hotspot.all({ where : { fromid : imageMappingWidget.id } },
          function (err, hotspots) {
            console.log(hotspots);
        for (i in hotspots) {
          var hotspot = hotspots[i];
          hotspot.destroy();
          console.log("removed" + hotspot);
        };
      });

热点的 console.log 输出一个空数组,我当然永远不会进入循环。

我的 imageMappingWidget 对象是

{ schema_version: 1,
  name: 'Testing 2',
  image: null,
  width: '3264',
  height: '2448',
  createDate: Sun Aug 24 2014 14:27:56 GMT+0200 (CEST),
  updateDate: Sun Aug 24 2014 14:27:56 GMT+0200 (CEST),
  uploadedImage: true,
  requiredWidth: null,
  id: 53f9da4c1ef48ced2a000001}

但是,如果我在命令行上从 mongo 执行以下查询

db.Hotspot.find({ fromid: "53f9da4c1ef48ced2a000001"})

我只得到了一张唱片。

4

1 回答 1

0

我想,在问完之后 - 我为什么不试着看看 id 上的 tostring 是否会有所帮助,而且确实如此。呸呸呸。

于 2014-09-08T22:08:38.880 回答