diff options
author | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2014-09-26 14:02:49 -0400 |
---|---|---|
committer | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2014-10-06 17:30:12 -0400 |
commit | 101e026f45dea5e9e68520238495c89a476e6172 (patch) | |
tree | bbdd3710ffc5721527ad9f5682ef0dbb4876dfee /src/mongo/db/commands/distinct.cpp | |
parent | 10c86dc6cad9853514148e0ab59894a0d29353b9 (diff) | |
download | mongo-101e026f45dea5e9e68520238495c89a476e6172.tar.gz |
SERVER-14668/SERVER-15294 Collection-level locking for all read paths
Diffstat (limited to 'src/mongo/db/commands/distinct.cpp')
-rw-r--r-- | src/mongo/db/commands/distinct.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/mongo/db/commands/distinct.cpp b/src/mongo/db/commands/distinct.cpp index de6ce85b6c3..4f34ea89aba 100644 --- a/src/mongo/db/commands/distinct.cpp +++ b/src/mongo/db/commands/distinct.cpp @@ -70,7 +70,6 @@ namespace mongo { bool fromRepl ) { Timer t; - string ns = dbname + '.' + cmdObj.firstElement().valuestr(); // ensure that the key is a string uassert(18510, @@ -98,10 +97,10 @@ namespace mongo { BSONArrayBuilder arr( bb ); BSONElementSet values; - Client::ReadContext ctx(txn, ns); - - Collection* collection = ctx.ctx().db()->getCollection( txn, ns ); + const string ns = parseNs(dbname, cmdObj); + AutoGetCollectionForRead ctx(txn, ns); + Collection* collection = ctx.getCollection(); if (!collection) { result.appendArray( "values" , BSONObj() ); result.append("stats", BSON("n" << 0 << |