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

feat(connection): add listCollections() helper to connections #14257

Merged
merged 2 commits into from Jan 14, 2024

Conversation

vkarpov15
Copy link
Collaborator

Summary

We have dropCollection() and dropDatabase() helpers on connections, but not listCollections(), so there's no way to list all connections in MongoDB without bypassing Mongoose. This PR adds a new Connection.prototype.listCollections() helper that wraps MongoDB's listCollections(), including handling the fact that listCollections() returns a cursor.

Examples

@vkarpov15 vkarpov15 added this to the 8.1 milestone Jan 13, 2024
lib/connection.js Outdated Show resolved Hide resolved
Copy link
Collaborator

@AbdelrahmanHafez AbdelrahmanHafez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of minor suggestions and a question, otherwise LGTM. 👍

types/connection.d.ts Outdated Show resolved Hide resolved
lib/connection.js Outdated Show resolved Hide resolved
test/connection.test.js Outdated Show resolved Hide resolved
types/connection.d.ts Outdated Show resolved Hide resolved
@vkarpov15
Copy link
Collaborator Author

Fixed all comments. You're right, I copy/pasted dropCollection() and missed a few spots.

@vkarpov15 vkarpov15 merged commit dad0da9 into 8.1 Jan 14, 2024
39 checks passed
@hasezoey hasezoey deleted the vkarpov15/listcollections branch January 15, 2024 12:13
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.

None yet

3 participants