Search code examples
mongodbshardingmongodb-replica-set

Will an application written for standalone MongoDB work for replica-set or sharded cluster without any changes?


Currently we are working with standalone mongodb without any replication or sharding, Now we are considering moving to replica-set for production purposes.

Will an application written for standalone mongodb will work for replica-set or sharded replica-set without any changes or are there some standalone/replica-set specific features in mongodb ?


Solution

  • Provided the MongoDB uses the default ports (27017 for standalone mongod and mongos) you don't need to touch your client application at all, it will work in either case.

    Of course, when you connect to a MongoDB then a sharded cluster has more options, but the defaults are fine.