Automattic / Automattic/mongoose

Option to not create the collection when compiling model

Open
#13,546 4 comments 0 reactions 0 assignees View on GitHub
enhancement new feature
Dominant language
JavaScript
Stars
27.5k
Forks
4k
Avg merge
2d 7h
Merged PRs (30d)
35

Description

### Prerequisites

- [X] I have written a descriptive issue title
- [X] I have searched existing issues to ensure the feature has not already been requested

### 🚀 Feature Proposal

Placing `null` in the collectionName argument should make it not create a collection for that model

### Motivation

_No response_

### Example

`mongoose.model(name, schema, null)`

Contributor guide

Open the contributing guide

Research direction

Start by tracing how mongoose.model(name, schema, null) handles the collectionName argument and where model compilation triggers collection creation. Confirm the expected behavior against the existing model and collection lifecycle tests; done means a null collection name compiles the model without creating a collection.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, mongodb
Domain
backend, databases
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.