summaryrefslogtreecommitdiff
path: root/db/ops/query.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'db/ops/query.cpp')
-rw-r--r--db/ops/query.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/db/ops/query.cpp b/db/ops/query.cpp
index 36f2536..1010912 100644
--- a/db/ops/query.cpp
+++ b/db/ops/query.cpp
@@ -816,6 +816,7 @@ namespace mongo {
curop.debug().ns = ns;
curop.debug().ntoreturn = pq.getNumToReturn();
+ curop.debug().query = jsobj;
curop.setQuery(jsobj);
if ( pq.couldBeCommand() ) {
@@ -916,6 +917,19 @@ namespace mongo {
Client& c = cc();
bool found = Helpers::findById( c, ns , query , resObject , &nsFound , &indexFound );
if ( nsFound == false || indexFound == true ) {
+
+ if ( shardingState.needShardChunkManager( ns ) ) {
+ ShardChunkManagerPtr m = shardingState.getShardChunkManager( ns );
+ if ( m && ! m->belongsToMe( resObject ) ) {
+ // I have something this _id
+ // but it doesn't belong to me
+ // so return nothing
+ resObject = BSONObj();
+ found = false;
+ }
+ }
+
+
BufBuilder bb(sizeof(QueryResult)+resObject.objsize()+32);
bb.skip(sizeof(QueryResult));