The primary difference when writing application code that addresses a sharded collection is to make sure you connect to a mongos instance. Otherwise, as shards are normally implemented as replica sets, the same considerations with regard to access to a replica set, addressed in Chapter 13, Deploying a Replica Set, would apply. The first consideration we'll examine is how to perform a basic connection to a sharded cluster.





















































