top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

MongoDB: If a collection is not sharded, does the mongos perform a merge-sort before returning the result of a query?

0 votes
958 views
MongoDB: If a collection is not sharded, does the mongos perform a merge-sort before returning the result of a query?
posted Feb 17, 2016 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button
Yes It will perform merge sort but in primary shard.

1 Answer

+1 vote

Here is the flow:
Step1:(All unsharded Collection in sharded database)All database in a sharded cluster have a “primary shard.” All unsharded collection within that database will reside on the same shard.
Step2.After a query,Merging result from other shards
Step3.Performs merge sort in primary shard in mongod
step4.Data returned to Mongos.

This image will clear your concept about shardening and Mongos #ReferenceOfImage -

answer Feb 26, 2016 by Shivam Kumar Pandey
Similar Questions
+1 vote

I am in the process of migrating a replica set from a data center to AWS, but when I checked the settings, I noticed that the Sharding is not enabled, yet they are using 3 MongoS / Routers and 3 MongoC / Config servers - So since Sharding is not used in the current system, would it be safe to migrate the replica sets and not use MonogoS nor MongoC ? Can the users connect directly to Mongo database replica set without using MongoS ?
Or should I use at least 1 MongoS and 1 MongoC config server ?

+1 vote

I am creating a sharded cluster with a 2 node config server replicaset.Due to some reason, the config server replicaset did not get created/setup properly.At this time, I started a mongos process configured to connect to this CSRS and on that box, I see lot of mongos processes getting created

Why wouldnt the mongos process just fail instead of keeping re-spawning and trying to connect to the CSRS? Related to this, how do we check (from an external script) that the CSRS is up & available before starting a mongos process?

The docs (https://docs.mongodb.com/manual/tutorial/troubleshoot-sharded-clusters/#sharding-config-servers-and-availability ) do mention that the CSRS should be available when you first initiate a sharded cluster, but does not mention how to do it.

0 votes

How to get all query which related 1 collection in mongodb? for oracle,we can get all query from system view like v$sql, but I am not sure if mongodb have this system view to see all query related 1 special collection?

...