Skip to content
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

Update jsdoc to use full URLs instead of non-prefix absolute urls (also fix some urls) #13328

Merged
merged 11 commits into from
Apr 25, 2023
4 changes: 2 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module.exports = {
'test/files/*',
'benchmarks',
'*.min.js',
'docs/js/native.js'
'**/docs/js/native.js'
],
overrides: [
{
Expand Down Expand Up @@ -77,7 +77,7 @@ module.exports = {
},
{
files: [
'docs/js/**/*.js'
'**/docs/js/**/*.js'
],
env: {
node: false,
Expand Down
6 changes: 5 additions & 1 deletion docs/source/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ const files = [
'lib/types/ArraySubdocument.js',
'lib/types/buffer.js',
'lib/types/decimal128.js',
'lib/types/map.js'
'lib/types/map.js',
'lib/types/array/methods/index.js'
];

/** @type {Map.<string, DocsObj>} */
Expand Down Expand Up @@ -179,6 +180,9 @@ function processName(input) {
name += basename;
}
}
if (fullName === 'types/array/methods/index') {
name = 'Array';
}
if (basename === 'SubdocumentPath') {
name = 'SubdocumentPath';
}
Expand Down
2 changes: 1 addition & 1 deletion docs/tutorials/findoneandupdate.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# How to Use `findOneAndUpdate()` in Mongoose

The [`findOneAndUpdate()` function in Mongoose](../api/query.html#query_Query-findOneAndUpdate) has a wide variety of use cases. [You should use `save()` to update documents where possible](https://masteringjs.io/tutorials/mongoose/update), for better [validation](../validation) and [middleware](../middleware) support.
The [`findOneAndUpdate()` function in Mongoose](../api/query.html#query_Query-findOneAndUpdate) has a wide variety of use cases. [You should use `save()` to update documents where possible](https://masteringjs.io/tutorials/mongoose/update), for better [validation](../validation.html) and [middleware](../middleware.html) support.
However, there are some cases where you need to use [`findOneAndUpdate()`](https://masteringjs.io/tutorials/mongoose/findoneandupdate). In this tutorial, you'll see how to use `findOneAndUpdate()`, and learn when you need to use it.

* [Getting Started](#getting-started)
Expand Down
26 changes: 13 additions & 13 deletions lib/aggregate.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const validRedactStringValues = new Set(['$$DESCEND', '$$PRUNE', '$$KEEP']);

/**
* Aggregate constructor used for building aggregation pipelines. Do not
* instantiate this class directly, use [Model.aggregate()](/docs/api/model.html#model_Model-aggregate) instead.
* instantiate this class directly, use [Model.aggregate()](https://mongoosejs.com/docs/api/model.html#Model.aggregate()) instead.
*
* #### Example:
*
Expand Down Expand Up @@ -64,20 +64,20 @@ function Aggregate(pipeline, model) {
* Contains options passed down to the [aggregate command](https://www.mongodb.com/docs/manual/reference/command/aggregate/).
* Supported options are:
*
* - [`allowDiskUse`](#aggregate_Aggregate-allowDiskUse)
* - [`allowDiskUse`](https://mongoosejs.com/docs/api/aggregate.html#Aggregate.prototype.allowDiskUse())
* - `bypassDocumentValidation`
* - [`collation`](#aggregate_Aggregate-collation)
* - [`collation`](https://mongoosejs.com/docs/api/aggregate.html#Aggregate.prototype.collation())
* - `comment`
* - [`cursor`](#aggregate_Aggregate-cursor)
* - [`explain`](#aggregate_Aggregate-explain)
* - [`cursor`](https://mongoosejs.com/docs/api/aggregate.html#Aggregate.prototype.cursor())
* - [`explain`](https://mongoosejs.com/docs/api/aggregate.html#Aggregate.prototype.explain())
* - `fieldsAsRaw`
* - [`hint`](#aggregate_Aggregate-hint)
* - [`hint`](https://mongoosejs.com/docs/api/aggregate.html#Aggregate.prototype.hint())
* - `let`
* - `maxTimeMS`
* - `raw`
* - [`readConcern`](#aggregate_Aggregate-readConcern)
* - [`readConcern`](https://mongoosejs.com/docs/api/aggregate.html#Aggregate.prototype.readConcern())
* - `readPreference`
* - [`session`](#aggregate_Aggregate-session)
* - [`session`](https://mongoosejs.com/docs/api/aggregate.html#Aggregate.prototype.session())
* - `writeConcern`
*
* @property options
Expand Down Expand Up @@ -187,7 +187,7 @@ Aggregate.prototype.addFields = function(arg) {
/**
* Appends a new $project operator to this aggregate pipeline.
*
* Mongoose query [selection syntax](#query_Query-select) is also supported.
* Mongoose query [selection syntax](https://mongoosejs.com/docs/api/query.html#Query.prototype.select()) is also supported.
*
* #### Example:
*
Expand Down Expand Up @@ -847,7 +847,7 @@ Aggregate.prototype.hint = function(value) {
};

/**
* Sets the session for this aggregation. Useful for [transactions](/docs/transactions.html).
* Sets the session for this aggregation. Useful for [transactions](https://mongoosejs.com/docs/transactions.html).
*
* #### Example:
*
Expand Down Expand Up @@ -879,8 +879,8 @@ Aggregate.prototype.session = function(session) {
* @param {Object} options keys to merge into current options
* @param {Number} [options.maxTimeMS] number limits the time this aggregation will run, see [MongoDB docs on `maxTimeMS`](https://www.mongodb.com/docs/manual/reference/operator/meta/maxTimeMS/)
* @param {Boolean} [options.allowDiskUse] boolean if true, the MongoDB server will use the hard drive to store data during this aggregation
* @param {Object} [options.collation] object see [`Aggregate.prototype.collation()`](#aggregate_Aggregate-collation)
* @param {ClientSession} [options.session] ClientSession see [`Aggregate.prototype.session()`](#aggregate_Aggregate-session)
* @param {Object} [options.collation] object see [`Aggregate.prototype.collation()`](https://mongoosejs.com/docs/api/aggregate.html#Aggregate.prototype.collation())
* @param {ClientSession} [options.session] ClientSession see [`Aggregate.prototype.session()`](https://mongoosejs.com/docs/api/aggregate.html#Aggregate.prototype.session())
* @see mongodb https://www.mongodb.com/docs/manual/reference/command/aggregate/
* @return {Aggregate} this
* @api public
Expand Down Expand Up @@ -1096,7 +1096,7 @@ Aggregate.prototype.then = function(resolve, reject) {
/**
* Executes the query returning a `Promise` which will be
* resolved with either the doc(s) or rejected with the error.
* Like [`.then()`](#query_Query-then), but only takes a rejection handler.
* Like [`.then()`](https://mongoosejs.com/docs/api/query.html#Query.prototype.then), but only takes a rejection handler.
* Compatible with `await`.
*
* @param {Function} [reject]
Expand Down
24 changes: 12 additions & 12 deletions lib/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const DocumentProvider = require('./document_provider.js');
DocumentProvider.setBrowser(true);

/**
* The [MongooseError](#error_MongooseError) constructor.
* The [MongooseError](https://mongoosejs.com/docs/api/error.html#Error()) constructor.
*
* @method Error
* @api public
Expand All @@ -18,7 +18,7 @@ DocumentProvider.setBrowser(true);
exports.Error = require('./error/index');

/**
* The Mongoose [Schema](#schema_Schema) constructor
* The Mongoose [Schema](https://mongoosejs.com/docs/api/schema.html#Schema()) constructor
*
* #### Example:
*
Expand All @@ -42,14 +42,14 @@ exports.Schema = require('./schema');
*
* #### Types:
*
* - [Array](/docs/schematypes.html#arrays)
* - [Buffer](/docs/schematypes.html#buffers)
* - [Embedded](/docs/schematypes.html#schemas)
* - [DocumentArray](/docs/api/documentarraypath.html)
* - [Decimal128](/docs/api/mongoose.html#mongoose_Mongoose-Decimal128)
* - [ObjectId](/docs/schematypes.html#objectids)
* - [Map](/docs/schematypes.html#maps)
* - [Subdocument](/docs/schematypes.html#schemas)
* - [Array](https://mongoosejs.com/docs/schematypes.html#arrays)
* - [Buffer](https://mongoosejs.com/docs/schematypes.html#buffers)
* - [Embedded](https://mongoosejs.com/docs/schematypes.html#schemas)
* - [DocumentArray](https://mongoosejs.com/docs/api/documentarraypath.html)
* - [Decimal128](https://mongoosejs.com/docs/api/decimal128.html#Decimal128())
* - [ObjectId](https://mongoosejs.com/docs/schematypes.html#objectids)
* - [Map](https://mongoosejs.com/docs/schematypes.html#maps)
* - [Subdocument](https://mongoosejs.com/docs/schematypes.html#schemas)
*
* Using this exposed access to the `ObjectId` type, we can construct ids on demand.
*
Expand All @@ -62,7 +62,7 @@ exports.Schema = require('./schema');
exports.Types = require('./types');

/**
* The Mongoose [VirtualType](#virtualtype_VirtualType) constructor
* The Mongoose [VirtualType](https://mongoosejs.com/docs/api/virtualtype.html#VirtualType()) constructor
*
* @method VirtualType
* @api public
Expand All @@ -77,7 +77,7 @@ exports.VirtualType = require('./virtualtype');
* _Alias of mongoose.Schema.Types for backwards compatibility._
*
* @property SchemaTypes
* @see Schema.SchemaTypes #schema_Schema-Types
* @see Schema.SchemaTypes https://mongoosejs.com/docs/api/schema.html#Schema.Types
* @api public
*/

Expand Down
16 changes: 8 additions & 8 deletions lib/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ Connection.prototype.get = function(key) {
*
* Supported options include:
*
* - `maxTimeMS`: Set [`maxTimeMS`](/docs/api/query.html#query_Query-maxTimeMS) for all queries on this connection.
* - `maxTimeMS`: Set [`maxTimeMS`](https://mongoosejs.com/docs/api/query.html#Query.prototype.maxTimeMS()) for all queries on this connection.
* - 'debug': If `true`, prints the operations mongoose sends to MongoDB to the console. If a writable stream is passed, it will log to that stream, without colorization. If a callback function is passed, it will receive the collection name, the method name, then all arugments passed to the method. For example, if you wanted to replicate the default logging, you could output from the callback `Mongoose: ${collectionName}.${methodName}(${methodArgs.join(', ')})`.
*
* #### Example:
Expand Down Expand Up @@ -207,7 +207,7 @@ Connection.prototype.name;
/**
* A [POJO](https://masteringjs.io/tutorials/fundamentals/pojo) containing
* a map from model names to models. Contains all models that have been
* added to this connection using [`Connection#model()`](/docs/api/connection.html#connection_Connection-model).
* added to this connection using [`Connection#model()`](https://mongoosejs.com/docs/api/connection.html#Connection.prototype.model()).
*
* #### Example:
*
Expand All @@ -227,7 +227,7 @@ Connection.prototype.models;

/**
* A number identifier for this connection. Used for debugging when
* you have [multiple connections](/docs/connections.html#multiple_connections).
* you have [multiple connections](https://mongoosejs.com/docs/connections.html#multiple_connections).
*
* #### Example:
*
Expand Down Expand Up @@ -939,7 +939,7 @@ function _setClient(conn, client, options, dbName) {
}

/**
* Destory the connection (not just a alias of [`.close`](#connection_Connection-close))
* Destory the connection (not just a alias of [`.close`](https://mongoosejs.com/docs/api/connection.html#Connection.prototype.close()))
*
* @param {Boolean} [force]
* @returns {Promise}
Expand Down Expand Up @@ -1132,7 +1132,7 @@ Connection.prototype.collection = function(name, options) {
* @param {Function} fn plugin callback
* @param {Object} [opts] optional options
* @return {Connection} this
* @see plugins /docs/plugins.html
* @see plugins https://mongoosejs.com/docs/plugins.html
* @api public
*/

Expand All @@ -1150,7 +1150,7 @@ Connection.prototype.plugin = function(fn, opts) {
* const Ticket = db.model('Ticket', new Schema(..));
* const Venue = db.model('Venue');
*
* _When no `collection` argument is passed, Mongoose produces a collection name by passing the model `name` to the [utils.toCollectionName](#utils_exports-toCollectionName) method. This method pluralizes the name. If you don't like this behavior, either pass a collection name or set your schemas collection name option._
* _When no `collection` argument is passed, Mongoose produces a collection name by passing the model `name` to the `utils.toCollectionName` method. This method pluralizes the name. If you don't like this behavior, either pass a collection name or set your schemas collection name option._
*
* #### Example:
*
Expand All @@ -1170,7 +1170,7 @@ Connection.prototype.plugin = function(fn, opts) {
* @param {String} [collection] name of mongodb collection (optional) if not given it will be induced from model name
* @param {Object} [options]
* @param {Boolean} [options.overwriteModels=false] If true, overwrite existing models with the same name to avoid `OverwriteModelError`
* @see Mongoose#model #index_Mongoose-model
* @see Mongoose#model https://mongoosejs.com/docs/api/mongoose.html#Mongoose.prototype.model()
* @return {Model} The compiled model
* @api public
*/
Expand Down Expand Up @@ -1324,7 +1324,7 @@ Connection.prototype.deleteModel = function(name) {

/**
* Watches the entire underlying database for changes. Similar to
* [`Model.watch()`](/docs/api/model.html#model_Model-watch).
* [`Model.watch()`](https://mongoosejs.com/docs/api/model.html#Model.watch()).
*
* This function does **not** trigger any middleware. In particular, it
* does **not** trigger aggregate middleware.
Expand Down
2 changes: 1 addition & 1 deletion lib/cursor/AggregationCursor.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const util = require('util');
* but **not** the model's post aggregate hooks.
*
* Unless you're an advanced user, do **not** instantiate this class directly.
* Use [`Aggregate#cursor()`](/docs/api/aggregate.html#aggregate_Aggregate-cursor) instead.
* Use [`Aggregate#cursor()`](https://mongoosejs.com/docs/api/aggregate.html#Aggregate.prototype.cursor()) instead.
*
* @param {Aggregate} agg
* @inherits Readable https://nodejs.org/api/stream.html#class-streamreadable
Expand Down
2 changes: 1 addition & 1 deletion lib/cursor/QueryCursor.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const util = require('util');
* from MongoDB, and the model's post `find` hooks after loading each document.
*
* Unless you're an advanced user, do **not** instantiate this class directly.
* Use [`Query#cursor()`](/docs/api/query.html#query_Query-cursor) instead.
* Use [`Query#cursor()`](https://mongoosejs.com/docs/api/query.html#Query.prototype.cursor()) instead.
*
* @param {Query} query
* @param {Object} options query options passed to `.find()`
Expand Down