ubuntu@ip-172-31-26-220:~/code$ mongod --version
|
db version v3.2.3
|
git version: b326ba837cf6f49d65c2f85e1b70f6f31ece7937
|
OpenSSL version: OpenSSL 1.0.1f 6 Jan 2014
|
allocator: tcmalloc
|
modules: none
|
build environment:
|
distmod: ubuntu1404
|
distarch: x86_64
|
target_arch: x86_64
|
|
> db.scores.find()
|
{ "_id" : 1, "subject" : "History", "score" : 88 }
|
{ "_id" : 2, "subject" : "History", "score" : 92 }
|
{ "_id" : 3, "subject" : "History", "score" : 97 }
|
{ "_id" : 4, "subject" : "History", "score" : 71 }
|
{ "_id" : 5, "subject" : "History", "score" : 79 }
|
{ "_id" : 6, "subject" : "History", "score" : 83 }
|
>
|
|
> db.scores.aggregate(
|
... [
|
... {
|
... $match: {
|
... score: {
|
... $gt: 80
|
... }
|
... }
|
... },
|
... {
|
... $count: "passing_scores"
|
... }
|
... ]
|
... )
|
assert: command failed: {
|
"ok" : 0,
|
"errmsg" : "Unrecognized pipeline stage name: '$count'",
|
"code" : 16436
|
} : aggregate failed
|
_getErrorWithCode@src/mongo/shell/utils.js:23:13
|
doassert@src/mongo/shell/assert.js:13:14
|
assert.commandWorked@src/mongo/shell/assert.js:266:5
|
DBCollection.prototype.aggregate@src/mongo/shell/collection.js:1215:5
|
@(shell):1:1
|
|
2016-12-08T20:48:42.551+0800 E QUERY [thread1] Error: command failed: {
|
"ok" : 0,
|
"errmsg" : "Unrecognized pipeline stage name: '$count'",
|
"code" : 16436
|
} : aggregate failed :
|
_getErrorWithCode@src/mongo/shell/utils.js:23:13
|
doassert@src/mongo/shell/assert.js:13:14
|
assert.commandWorked@src/mongo/shell/assert.js:266:5
|
DBCollection.prototype.aggregate@src/mongo/shell/collection.js:1215:5
|
@(shell):1:1
|
|
>
|