Skip to content

docs: update deleteOne & deleteMany API def #15360

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

Merged
merged 1 commit into from
Apr 22, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 10 additions & 12 deletions lib/query.js
Original file line number Diff line number Diff line change
Expand Up @@ -3096,13 +3096,12 @@ function _handleSortValue(val, key) {
*
* await Character.deleteOne({ name: 'Eddard Stark' });
*
* This function calls the MongoDB driver's [`Collection#deleteOne()` function](https://mongodb.github.io/node-mongodb-native/4.9/classes/Collection.html#deleteOne).
* This function calls the MongoDB driver's [`Collection#deleteOne()` function](https://mongodb.github.io/node-mongodb-native/6.15/classes/Collection.html#deleteOne).
* The returned [promise](https://mongoosejs.com/docs/queries.html) resolves to an
* object that contains 3 properties:
* object that contains 2 properties:
*
* - `ok`: `1` if no errors occurred
* - `acknowledged`: boolean
* - `deletedCount`: the number of documents deleted
* - `n`: the number of documents deleted. Equal to `deletedCount`.
*
* #### Example:
*
Expand All @@ -3113,8 +3112,8 @@ function _handleSortValue(val, key) {
* @param {Object|Query} [filter] mongodb selector
* @param {Object} [options] optional see [`Query.prototype.setOptions()`](https://mongoosejs.com/docs/api/query.html#Query.prototype.setOptions())
* @return {Query} this
* @see DeleteResult https://mongodb.github.io/node-mongodb-native/4.9/interfaces/DeleteResult.html
* @see deleteOne https://mongodb.github.io/node-mongodb-native/4.9/classes/Collection.html#deleteOne
* @see DeleteResult https://mongodb.github.io/node-mongodb-native/6.15/interfaces/DeleteResult.html
* @see deleteOne https://mongodb.github.io/node-mongodb-native/6.15/classes/Collection.html#deleteOne
* @api public
*/

Expand Down Expand Up @@ -3169,13 +3168,12 @@ Query.prototype._deleteOne = async function _deleteOne() {
*
* await Character.deleteMany({ name: /Stark/, age: { $gte: 18 } });
*
* This function calls the MongoDB driver's [`Collection#deleteMany()` function](https://mongodb.github.io/node-mongodb-native/4.9/classes/Collection.html#deleteMany).
* This function calls the MongoDB driver's [`Collection#deleteMany()` function](https://mongodb.github.io/node-mongodb-native/6.15/classes/Collection.html#deleteMany).
* The returned [promise](https://mongoosejs.com/docs/queries.html) resolves to an
* object that contains 3 properties:
* object that contains 2 properties:
*
* - `ok`: `1` if no errors occurred
* - `acknowledged`: boolean
* - `deletedCount`: the number of documents deleted
* - `n`: the number of documents deleted. Equal to `deletedCount`.
*
* #### Example:
*
Expand All @@ -3186,8 +3184,8 @@ Query.prototype._deleteOne = async function _deleteOne() {
* @param {Object|Query} [filter] mongodb selector
* @param {Object} [options] optional see [`Query.prototype.setOptions()`](https://mongoosejs.com/docs/api/query.html#Query.prototype.setOptions())
* @return {Query} this
* @see DeleteResult https://mongodb.github.io/node-mongodb-native/4.9/interfaces/DeleteResult.html
* @see deleteMany https://mongodb.github.io/node-mongodb-native/4.9/classes/Collection.html#deleteMany
* @see DeleteResult https://mongodb.github.io/node-mongodb-native/6.15/interfaces/DeleteResult.html
* @see deleteMany https://mongodb.github.io/node-mongodb-native/6.15/classes/Collection.html#deleteMany
* @api public
*/

Expand Down