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.
![](https://secure.gravatar.com/avatar/448ff8d0ae7cf7011026531a2e62133c?size=40&default=https%3A%2F%2Fassets.uvcdn.com%2Fpkg%2Fadmin%2Ficons%2Fuser_70-6bcf9e08938533adb9bac95c3e487cb2a6d4a32f890ca6fdc82e3072e0ea0368.png)