0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-11-30 09:06:21 +01:00

SERVER-17544 make $where work in the new mongos read path

This commit is contained in:
David Storch 2015-08-12 13:06:57 -04:00
parent 870efac99e
commit 2f7b99c780
4 changed files with 16 additions and 2 deletions

View File

@ -79,5 +79,13 @@
assert.eq(cmdRes.cursor.firstBatch.length, 1);
assert.eq(cmdRes.cursor.firstBatch[0], {_id: -5});
// A predicate with $where.
cmdRes = db.runCommand({find: coll.getName(), filter: {$where: "this._id == 5"}});
assert.commandWorked(cmdRes);
assert.eq(cmdRes.cursor.id, NumberLong(0));
assert.eq(cmdRes.cursor.ns, coll.getFullName());
assert.eq(cmdRes.cursor.firstBatch.length, 1);
assert.eq(cmdRes.cursor.firstBatch[0], {_id: 5});
st.stop();
})();

View File

@ -168,7 +168,7 @@ public:
return appendCommandStatus(result, lpq.getStatus());
}
auto cq = CanonicalQuery::canonicalize(lpq.getValue().release());
auto cq = CanonicalQuery::canonicalize(lpq.getValue().release(), WhereCallbackNoop());
if (!cq.isOK()) {
return appendCommandStatus(result, cq.getStatus());
}

View File

@ -229,6 +229,12 @@ bool shardVersionOk(OperationContext* txn,
ChunkVersion& received,
ChunkVersion& wanted) {
Client* client = txn->getClient();
// Operations using the DBDirectClient are unversioned.
if (client->isInDirectClient()) {
return true;
}
ShardingState* shardingState = ShardingState::get(client->getServiceContext());
if (!shardingState->enabled()) {
return true;

View File

@ -195,7 +195,7 @@ void Strategy::queryOp(OperationContext* txn, Request& r) {
uassertStatusOK(readPrefExtractStatus);
}
auto canonicalQuery = CanonicalQuery::canonicalize(q);
auto canonicalQuery = CanonicalQuery::canonicalize(q, WhereCallbackNoop());
uassertStatusOK(canonicalQuery.getStatus());
// Do the work to generate the first batch of results. This blocks waiting to get responses