feat(model): expose collections via read-only OAuth2Server getter #27 #28
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Exposes the MongoDB collections (
AccessTokens,RefreshTokens,AuthCodes,Clients) via a read-onlycollectionsgetter onOAuth2Server. The getter returns a frozen object to prevent mutations, ensuring OAuth2 compliance while allowing custom queries/indexing.Changes
collectionsfromlib/model/meteor-model.js.this.collectionsinOAuthMeteorModelconstructor (lib/model/model.js).get collections()getter toOAuth2Server(lib/oauth.js) usingObject.freezefor read-only access.API.mdviameteor npm run build:docs.tests/model-tests.jsto verify getter and read-only behavior.Motivation
Users need direct access to collections for custom logic (e.g., querying expired tokens or creating indexes). This provides a safe, controlled way without exposing internal model details or requiring low-level MongoDB driver APIs.
Testing
meteor npm run test).collectionsgetter returnsMongo.Collectioninstances and enforces read-only behavior.meteor npm run lint).Example Usage
Notes
developmentBranch: TheCONTRIBUTING.mdmentioningdevelopmentseems outdated.