Support change streams without service discovery
Currently, change streams are not supported in standalone instances, so testing change stream functionality requires a one-node replica set. However, promoting a standalone node to a one-node replica set requires a call to rs.initiate(config)
, which requires host and port information so that clients can connect; something that is not required for standalone nodes. This means change stream support is conflated with service discovery. It becomes impossible, for example, to create a docker image that boots as a single-node replica set, while it's trivial to make a docker image that boots as a standalone server.
Various ideas that would make this easier:
Make rs.initiate() (with no configuration) default to a single-node cluster that clients connect to using the host and port from their connection string. (Current behaviour defaults to "localhost:27017" which is risky, since it can cause two separate single-node replica sets to be quietly interconnected if one of them happens to be on localhost:27017.)
Support change streams in standalone nodes. While it's understandable that standalone nodes don't support change streams because they have no oplog, this is still a rather major omission in the functionality of standalone nodes.