9
我試圖通過對MongoDB的集合做一組(我的版本是2.2.2)MongoDB的聚合函數
db.stream.aggregate({$group: { MyId:"A1"}})
,但我得到了以下錯誤:
19 11:56:20 TypeError: db.stream.aggregate is not a function (shell):1
非常感謝,
我試圖通過對MongoDB的集合做一組(我的版本是2.2.2)MongoDB的聚合函數
db.stream.aggregate({$group: { MyId:"A1"}})
,但我得到了以下錯誤:
19 11:56:20 TypeError: db.stream.aggregate is not a function (shell):1
非常感謝,
您必須使用2.2。+版本的shell才能夠使用aggregate
幫助程序。
您可以在shell提示下使用version()
命令檢查shell版本。
此外,您的聚集語法是不正確的 - $group
運營商必須設置一個域名爲_id
(你有MyId
)這就是告訴它你是通過聚合的字段。
這不適合我。外殼版本是2.4和mongo版本是3+仍然有相同的錯誤。 –
你確定你使用2.2 shell而不只是2.2服務器嗎? – Sammaye
僅供參考:您可以在mongo shell提示符下輸入> version()來獲取shell的版本或> db.version()來獲取服務器的版本。 –