|
The Read Concern Documention mentions both count and aggregate, but does not include special cases for count() and aggregate().
It also doesn't mention that read concern, as currently implemented, can prevent reads from non-replicated collections, such as system.profile:
MongoDB Enterprise cross:PRIMARY> rs.status()
|
{
|
"set" : "cross",
|
"date" : ISODate("2016-03-31T19:44:40.784Z"),
|
"myState" : 1,
|
"term" : NumberLong(1),
|
"heartbeatIntervalMillis" : NumberLong(2000),
|
"members" : [
|
{
|
"_id" : 0,
|
"name" : "localhost:27017",
|
"health" : 1,
|
"state" : 1,
|
"stateStr" : "PRIMARY",
|
"uptime" : 4354,
|
"optime" : {
|
"ts" : Timestamp(1459450599, 1),
|
"t" : NumberLong(1)
|
},
|
"optimeDate" : ISODate("2016-03-31T18:56:39Z"),
|
"electionTime" : Timestamp(1459449128, 2),
|
"electionDate" : ISODate("2016-03-31T18:32:08Z"),
|
"configVersion" : 3,
|
"self" : true
|
},
|
{
|
"_id" : 1,
|
"name" : "localhost:27018",
|
"health" : 1,
|
"state" : 2,
|
"stateStr" : "SECONDARY",
|
"uptime" : 4352,
|
"optime" : {
|
"ts" : Timestamp(1459449254, 3),
|
"t" : NumberLong(1)
|
},
|
"optimeDate" : ISODate("2016-03-31T18:34:14Z"),
|
"lastHeartbeat" : ISODate("2016-03-31T19:44:39.992Z"),
|
"lastHeartbeatRecv" : ISODate("2016-03-31T19:44:39.026Z"),
|
"pingMs" : NumberLong(0),
|
"syncingTo" : "localhost:27017",
|
"configVersion" : 3
|
},
|
{
|
"_id" : 2,
|
"name" : "localhost:27019",
|
"health" : 1,
|
"state" : 2,
|
"stateStr" : "SECONDARY",
|
"uptime" : 4352,
|
"optime" : {
|
"ts" : Timestamp(1459449254, 3),
|
"t" : NumberLong(1)
|
},
|
"optimeDate" : ISODate("2016-03-31T18:34:14Z"),
|
"lastHeartbeat" : ISODate("2016-03-31T19:44:39.992Z"),
|
"lastHeartbeatRecv" : ISODate("2016-03-31T19:44:40.397Z"),
|
"pingMs" : NumberLong(0),
|
"syncingTo" : "localhost:27017",
|
"configVersion" : 3
|
}
|
],
|
"ok" : 1
|
}
|
MongoDB Enterprise cross:PRIMARY> db.system.profile.find().readConcern("majority")
|
MongoDB Enterprise cross:PRIMARY> db.system.profile.find()
|
{ "op" : "insert", "ns" : "test.foo", "query" : { "insert" : "foo", "ordered" : true, "documents" : [ { "a" : 1, "_id" : ObjectId("56fd6da682bf194207b5ca3b") } ], "writeConcern" : { "wtimeout" : 10000, "w" : "majority" } }, "ninserted" : 1, "keyUpdates" : 0, "writeConflicts" : 0, "numYield" : 0, "locks" : { "Global" : { "acquireCount" : { "r" : NumberLong(4), "w" : NumberLong(4) } }, "Database" : { "acquireCount" : { "w" : NumberLong(3), "W" : NumberLong(1) } }, "Collection" : { "acquireCount" : { "w" : NumberLong(1), "W" : NumberLong(1) } }, "Metadata" : { "acquireCount" : { "w" : NumberLong(2) } }, "oplog" : { "acquireCount" : { "w" : NumberLong(2) } } }, "responseLength" : 100, "protocol" : "op_query", "millis" : 67, "execStats" : { }, "ts" : ISODate("2016-03-31T18:34:14.727Z"), "client" : "127.0.0.1", "allUsers" : [ ], "user" : "" }
|
{ "op" : "command", "ns" : "test.foo", "command" : { "count" : "foo", "query" : { }, "readConcern" : { "level" : "majority" } }, "keyUpdates" : 0, "writeConflicts" : 0, "numYield" : 0, "locks" : { "Global" : { "acquireCount" : { "r" : NumberLong(2) } }, "Database" : { "acquireCount" : { "r" : NumberLong(1) } }, "Collection" : { "acquireCount" : { "r" : NumberLong(1) } } }, "responseLength" : 62, "protocol" : "op_query", "millis" : 0, "execStats" : { }, "ts" : ISODate("2016-03-31T18:34:14.729Z"), "client" : "127.0.0.1", "allUsers" : [ ], "user" : "" }
|
{ "op" : "query", "ns" : "test.foo", "query" : { "find" : "foo", "filter" : { }, "readConcern" : { "level" : "majority" } }, "keysExamined" : 0, "docsExamined" : 1, "cursorExhausted" : true, "keyUpdates" : 0, "writeConflicts" : 0, "numYield" : 0, "locks" : { "Global" : { "acquireCount" : { "r" : NumberLong(2) } }, "Database" : { "acquireCount" : { "r" : NumberLong(1) } }, "Collection" : { "acquireCount" : { "r" : NumberLong(1) } } }, "nreturned" : 1, "responseLength" : 146, "protocol" : "op_query", "millis" : 0, "execStats" : { "stage" : "COLLSCAN", "filter" : { "$and" : [ ] }, "nReturned" : 1, "executionTimeMillisEstimate" : 0, "works" : 3, "advanced" : 1, "needTime" : 1, "needYield" : 0, "saveState" : 0, "restoreState" : 0, "isEOF" : 1, "invalidates" : 0, "direction" : "forward", "docsExamined" : 1 }, "ts" : ISODate("2016-03-31T18:34:14.729Z"), "client" : "127.0.0.1", "allUsers" : [ ], "user" : "" }
|
MongoDB Enterprise cross:PRIMARY>
|
|