0
我想返回一個結果數組,使用Mongoose
和mongoDB
在Node.js
。返回MongoDB/Mongoose聚合匹配第一個字母
我有這樣的事情每一個與za
啓動例如報頭相匹配:
Model.aggregate(
{ $project: { firstLetter : { $substr : ["$header", 0, 2] }}},
{ $match: { firstLetter : 'za' }},
{ $limit: 40 }
);
但是,當我把結果賦值給一個變量,它僅僅是一個Aggregate
對象,我不能確定做什麼用。
貓鼬文檔狀態:
The documents returned are plain javascript objects, not mongoose documents (since any shape of document can be returned).
爲什麼我沒有得到的結果?