Support for options argument when creating a single document in Model.create(): use Model.insertOne() instead #14843
Labels
enhancement
This issue is a user-facing general improvement that doesn't fix a bug or add a new feature
new feature
This change adds new functionality, like a new method or class
Milestone
Prerequisites
🚀 Feature Proposal
Enhance the
Model.create()
method to allow passing anoptions
argument when creating a single document. Currently, this is only possible when documents are passed as an array, which is inconvenient for cases where only a single document needs to be created.Motivation
The current implementation of the
Model.create()
method requires documents to be passed as an array when using theoptions
argument, even if only a single document is being created. This approach is less intuitive and can lead to unnecessary complexity, such as having to handle an array in return when only a single document is expected. Allowing theoptions
argument to be used with a single document directly would result in cleaner, more straightforward code and avoid the need to deal with array structures when they aren't necessary.Example
Current Implementation:
Proposed Implementation:
The text was updated successfully, but these errors were encountered: