I'm trying to implement this function to move documents from one collection to another. It seems to be written in native mongoDB. Here is how I am connecting to my database currently:
mongoose.connect(configDB.url,{ useNewUrlParser: true , useUnifiedTopology: true});
mongoose.set('useCreateIndex', true);
I am calling moveDocuments() in a separate file from where this connection happens, but the function isn't properly moving the documents, and I wonder if this might be an issue with the differences between mongoose and mongoDB? For example, do I need to change count() to countDocuments()?
Alternately, is there a way I could change how I am connecting to the database so that moveDocuments() will work better?