Glad to hear that you’re upgrading from 2.1.5!
Unfortunately you are unable to go straight from 2.1.5 to 4.0 due to potential compatibility issues, it may work for you but this upgrade path has not been through our full QA suite of tests.
Instead your upgrade path should be:
You can perform these upgrades by any method that you wish, which are covered in upgrade strategies, although I would recommend online upgrades as they ensure that your cluster remains fully operational during the upgrade process!
Finally, you should ensure that all nodes in the cluster have been fully upgraded to the next version before beginning subsequent steps.
e.g All nodes must be at 2.2 in the cluster before you begin upgrading any of them to 2.5.2.
May I also ask what version of the node.js SDK you are using? You may want to ensure that you are running the latest version before performing the upgrade as older versions (particularly pre-2.x) of the SDK may have trouble when there are topology changes (which there will be during the upgrade if doing this online).
If you do plan to upgrade your version of the node.js SDK you will probably want to fully test this and do it before upgrading your Couchbase cluster to 4.0.
If all of that sounds like a lot of work for you and you have the spare hardware, an alternative could also be to stand up a brand new cluster on 4.0, configured how you would like and populate it with the data from your existing 2.1.5 cluster.
You could do this by taking a backup with cbbackup and then restoring the data to the new cluster.
Alternatively you could use XDCR to transfer the data across, although I am not 100% sure of the compatibility with 4.x, I think that it should work correctly but it’s worth testing.
Hope this helps, let me know if you have any more questions!