Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Agenda cleanup script to latest MongoDB client #2410

Merged
merged 1 commit into from
Oct 9, 2021

Conversation

simison
Copy link
Contributor

@simison simison commented Oct 9, 2021

Run NODE_ENV=production npm run agenda-maintenance

Output before:

(node:920) [MONGODB DRIVER] Warning: Current Server Discovery and Monitoring engine is deprecated, and will be removed in a future version. To use the new Server Discover and Monitoring engine, pass option { useUnifiedTopology: true } to the MongoClient constructor.
(Use `node --trace-warnings ...` to show where the warning was created)
Connected to MongoDB: mongodb://localhost/trust-roots
/trustroots/node_modules/mongodb/lib/topologies/server.js:294
          throw err;
          ^

TypeError: dbConnection.collection is not a function
    at /trustroots/bin/db-maintenance/archive-done-agenda-jobs.js:117:42
    at /trustroots/node_modules/mongodb/lib/utils.js:704:5
    at /trustroots/node_modules/mongodb/lib/mongo_client.js:261:7
    at connectCallback (/trustroots/node_modules/mongodb/lib/operations/connect.js:365:5)
    at /trustroots/node_modules/mongodb/lib/operations/connect.js:458:5
    at Server.connectHandler (/trustroots/node_modules/mongodb/lib/topologies/server.js:291:9)
    at Object.onceWrapper (events.js:483:26)
    at Server.emit (events.js:376:20)
    at Pool.<anonymous> (/trustroots/node_modules/mongodb/lib/core/topologies/server.js:384:12)
    at Pool.emit (events.js:376:20)

Output after:

(node:1983) [MONGODB DRIVER] Warning: Current Server Discovery and Monitoring engine is deprecated, and will be removed in a future version. To use the new Server Discover and Monitoring engine, pass option { useUnifiedTopology: true } to the MongoClient constructor.
(Use `node --trace-warnings ...` to show where the warning was created)
Connected to MongoDB: mongodb://localhost/trust-roots
Counting docs...
Going to move 891087 documents from agendaJobs to agendaJobsArchived


Source count: 891096
Target count: 125740
Total: 1016836

Fetching docs for transfer...


Processing 891087 docs...

@simison simison added the admin label Oct 9, 2021
@simison simison merged commit 75d0e48 into master Oct 9, 2021
@simison simison deleted the update/agenda-cleanup-script branch October 9, 2021 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant