Skip to content

Conversation

@IslandRhythms
Copy link
Collaborator

No description provided.

Copy link
Collaborator

@vkarpov15 vkarpov15 left a comment

Choose a reason for hiding this comment

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

More testing required. Also please add TypeScript type definition and TypeScript test please

@vkarpov15 vkarpov15 marked this pull request as draft August 20, 2024 21:44
@vkarpov15 vkarpov15 changed the base branch from 8.6 to 8.8 October 26, 2024 18:04
@vkarpov15 vkarpov15 marked this pull request as ready for review October 26, 2024 18:04
@vkarpov15 vkarpov15 changed the base branch from 8.8 to 8.10 December 18, 2024 02:49
@vkarpov15 vkarpov15 merged commit 8f05374 into 8.10 Dec 18, 2024
65 checks passed
@vkarpov15 vkarpov15 added this to the 8.10 milestone Dec 18, 2024
@hasezoey hasezoey deleted the IslandRhythms/use-connection branch January 9, 2025 11:39
Comment on lines +193 to +195
this.db = connection;
const collection = connection.collection(this.modelName, connection.options);
this.prototype.collection = collection;
Copy link

@meshde-flux meshde-flux Sep 11, 2025

Choose a reason for hiding this comment

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

I believe this makes it such that the name of the collection is always set to the modelName which would be different from the name of the collection assigned initially, which could either be a user-defined collection name or one that is automatically generated by mongoose using the utils.toCollectionName as mentioned here: https://mongoosejs.com/docs/api/connection.html#Connection.prototype.model().

This leads to the case where a new collection is created and used once useConnection is invoked on the model. Is that intentional?

Copy link
Collaborator

Choose a reason for hiding this comment

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

That's a good point @meshde-flux , I will open up new issue

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.

4 participants