我有一個集合,其字段有時是ISODate,有時是Date。我需要將日期字段轉換爲ISODate,但我不確定如何過濾文檔。我願意在查詢或代碼中這樣做。我沒有找到一種ISODate來檢查字段的instanceof/type。建議?在Mongo中查找ISODate字段的文檔
Item.find(function(err, docs) {
docs.forEach(function(d) {
if(d.updated instanceof ISODate) // That type does not exist mongoose/mongo Types.
...
})
});
你能發表一個'docs'的例子嗎? –