From eaaa7b30c99b89b5483e0a372bb73fe8c8695185 Mon Sep 17 00:00:00 2001 From: Antonin Kral Date: Fri, 30 Mar 2012 21:40:45 +0200 Subject: Imported Upstream version 2.0.4 --- db/ops/query.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'db/ops/query.cpp') 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)); -- cgit v1.2.3