0

私はMongoからいくつかのデータを取得するために、jugglingdbでcompoundjsを使用しています。私のコードには次のものがあります

 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);
        };
      });

hotspots の 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"})

ちょうど 1 つのレコードが返されます。

4

1 に答える 1

0

尋ねた直後に、IDのtostringが役立つかどうかを確認してみませんか?うーん。

于 2014-09-08T22:08:38.880 に答える