Migrating from contrib mongodb2 node to contrib mongodb

I have been using node-red-contrib-mongodb2 but it's poorly supported. I'm in the process of migrating to node-red-node-mongodb, and I have two challenges:

  1. I use logic that tests for the outcome of updates and inserts (e.g. possibility of key not found or duplicate key), but I don't see how to do that with the mongodb node. Are exceptions thrown? What is recommended?

  2. I'm currently able to do a partial update of a document, e.g. there are 10 fields and I want to change 2 of them without eliminating the others. I can do that in mongodb2, but it isn't obvious how to do it with mongodb.

Thanks!

I can't help you with this but I've edited the title a better describe what you need help with. When seeing the title I figured it's about migrating data from a new Mongodb version to an older one which would not fit the forum and would possibly be difficult (I've never used mongodb myself).

Thanks for clarifying the title. The connection string that I had been using with mongodb2 to connect to MongoDB version 3.6 running on Atlas would not work on version 4.2 (also on Atlas). I did some experiments with node-red-node-mongodb 0.2.1 and I got it to connect to 4.2. However, I soon discovered that the difference in behavior between those two packages was going to require a lot of recoding. The two challenges I mentioned above caused me to double back.

Ultimately, I reached a tech at Atlas who was able to conjure up a connection string that enabled mongodb2 to connect to version 4.2. The new string makes use of a replicaSet parameter. So I guess that's problem solved. I can finally upgrade my database.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.