Skip to content

Commit 4324a04

Browse files
authored
Merge pull request #12690 from hasezoey/updateRemainingLinks
[DOCS] Update remaining relative and static links, also add style guidelines for documentation
2 parents 294d85e + 7a0a0ec commit 4324a04

19 files changed

+164
-162
lines changed

CONTRIBUTING.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ If you have a question about Mongoose (not a bug report) please post it to eithe
3535
- Write typings-tests if you modify the typescript-typings. (tests are in the [test/types](https://github.com/Automattic/mongoose/tree/master/test/types) directory).
3636

3737
### Running the tests
38+
3839
- Open a terminal and navigate to the root of the project
3940
- execute `npm install` to install the necessary dependencies
4041
- execute `npm run mongo` to start a MongoDB instance on port 27017. This step is optional, if you have already a database running on port 27017. To spin up a specific mongo version, you can do it by executing `npm run mongo -- {version}`. E.g. you want to spin up a mongo 4.2.2 server, you execute `npm run mongo -- 4.2.2`
@@ -50,7 +51,7 @@ If you have a question about Mongoose (not a bug report) please post it to eithe
5051

5152
To contribute to the [API documentation](http://mongoosejs.com/docs/api.html) just make your changes to the inline documentation of the appropriate [source code](https://github.com/Automattic/mongoose/tree/master/lib) in the master branch and submit a [pull request](https://help.github.com/articles/using-pull-requests/). You might also use the github [Edit](https://github.com/blog/844-forking-with-the-edit-button) button.
5253

53-
To contribute to the [guide](http://mongoosejs.com/docs/guide.html) or [quick start](http://mongoosejs.com/docs/index.html) docs, make your changes to the appropriate `.pug` files in the [docs](https://github.com/Automattic/mongoose/tree/master/docs) directory of the master branch and submit a pull request. Again, the [Edit](https://github.com/blog/844-forking-with-the-edit-button) button might work for you here.
54+
To contribute to the [guide](http://mongoosejs.com/docs/guide.html) or [quick start](http://mongoosejs.com/docs/index.html) docs, make your changes to the appropriate `.pug` / `.md` files in the [docs](https://github.com/Automattic/mongoose/tree/master/docs) directory of the master branch and submit a pull request. Again, the [Edit](https://github.com/blog/844-forking-with-the-edit-button) button might work for you here.
5455

5556
If you'd like to preview your documentation changes, first commit your changes to your local master branch, then execute:
5657

@@ -59,29 +60,30 @@ If you'd like to preview your documentation changes, first commit your changes t
5960

6061
Visit `http://localhost:8089` and you should see the docs with your local changes. Make sure you `npm run docs:clean` before committing, because automated generated files to `docs/*` should **not** be in PRs.
6162

63+
#### Documentation Style Guidelines
64+
65+
There are some guidelines to keep the style for the documentation consistent:
66+
67+
- All links that refer to some other file in the mongoose documentation needs to be relative without a prefix unless required (use `guide.html` over `./guide.html` or `/docs/guide.html`)
68+
6269
### Plugins website
6370

6471
The [plugins](http://plugins.mongoosejs.io/) site is also an [open source project](https://github.com/vkarpov15/mongooseplugins) that you can get involved with. Feel free to fork and improve it as well!
6572

66-
6773
## Financial contributions
6874

6975
We also welcome financial contributions in full transparency on our [open collective](https://opencollective.com/mongoose).
7076
Anyone can file an expense. If the expense makes sense for the development of the community, it will be "merged" in the ledger of our open collective by the core contributors and the person who filed the expense will be reimbursed.
7177

72-
7378
## Credits
7479

75-
7680
### Contributors
7781

7882
Thank you to all the people who have already contributed to mongoose!
7983
<a href="https://github.com/Automattic/mongoose/graphs/contributors"><img src="https://opencollective.com/mongoose/contributors.svg?width=890" /></a>
8084

81-
8285
### Backers
8386

8487
Thank you to all our backers! [[Become a backer](https://opencollective.com/mongoose#backer)]
8588

8689
<a href="https://opencollective.com/mongoose#backers" target="_blank"><img src="https://opencollective.com/mongoose/backers.svg?width=890"></a>
87-

docs/async-await.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ async function awaitUpdate() {
6262
}
6363
```
6464

65-
Note that the specific fulfillment values of different Mongoose methods vary, and may be affected by configuration. Please refer to the [API documentation](./api.html) for information about specific methods.
65+
Note that the specific fulfillment values of different Mongoose methods vary, and may be affected by configuration. Please refer to the [API documentation](api.html) for information about specific methods.
6666

6767
### Async Functions
6868

@@ -108,7 +108,7 @@ Under the hood, [async/await is syntactic sugar](https://developer.mozilla.org/e
108108
Due to the surprisingly simple way promises are implemented in JavaScript, the keyword `await` will try to unwrap any object with a property whose key is the string ‘then’ and whose value is a function.
109109
Such objects belong to a broader class of objects called [thenables](https://masteringjs.io/tutorials/fundamentals/thenable).
110110
If the thenable being unwrapped is a genuine promise, e.g. an instance of the [Promise constructor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise), we enjoy several guarantees about how the object’s ‘then’ function will behave.
111-
However, Mongoose provides several static helper methods that return a different class of thenable object called a [Query](./queries.html)--and [Queries are not promises](./queries.html#queries-are-not-promises).
111+
However, Mongoose provides several static helper methods that return a different class of thenable object called a [Query](queries.html)--and [Queries are not promises](queries.html#queries-are-not-promises).
112112
Because Queries are also *thenables*, we can interact with a Query using async/await just as we would interact with a genuine promise, with one key difference: observing the fulfillment value of a genuine promise cannot under any circumstances change that value, but trying to re-observe the value of a Query may cause the Query to be re-executed.
113113

114114
```javascript
@@ -148,4 +148,4 @@ async function observeQuery() {
148148

149149
You are most likely to accidentally re-execute queries in this way when mixing callbacks with async/await.
150150
This is never necessary and should be avoided.
151-
If you need a Query to return a fully-fledged promise instead of a thenable, you can use [Query#exec()](./api/query.html#query_Query-exec).
151+
If you need a Query to return a fully-fledged promise instead of a thenable, you can use [Query#exec()](api/query.html#query_Query-exec).

docs/connections.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ setTimeout(function() {
6060
}, 60000);
6161
```
6262

63-
To disable buffering, turn off the [`bufferCommands` option on your schema](./guide.html#bufferCommands).
63+
To disable buffering, turn off the [`bufferCommands` option on your schema](guide.html#bufferCommands).
6464
If you have `bufferCommands` on and your connection is hanging, try turning
6565
`bufferCommands` off to see if you haven't opened a connection properly.
6666
You can also disable `bufferCommands` globally:
@@ -178,7 +178,7 @@ See [this page](http://mongodb.github.io/node-mongodb-native/3.1/reference/faq/)
178178
<h3 id="callback"><a href="#callback">Callback</a></h3>
179179

180180
The `connect()` function also accepts a callback parameter and returns a
181-
[promise](./promises.html).
181+
[promise](promises.html).
182182

183183
```javascript
184184
mongoose.connect(uri, options, function(error) {
@@ -379,8 +379,8 @@ The `mongoose.createConnection()` function takes the same arguments as
379379
const conn = mongoose.createConnection('mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]', options);
380380
```
381381

382-
This [connection](./api.html#connection_Connection) object is then used to
383-
create and retrieve [models](./api.html#model_Model). Models are
382+
This [connection](api.html#connection_Connection) object is then used to
383+
create and retrieve [models](api.html#model_Model). Models are
384384
**always** scoped to a single connection.
385385

386386
```javascript

docs/documents.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
## Documents
22

3-
Mongoose [documents](./api/document.html) represent a one-to-one mapping
3+
Mongoose [documents](api/document.html) represent a one-to-one mapping
44
to documents as stored in MongoDB. Each document is an instance of its
5-
[Model](./models.html).
5+
[Model](models.html).
66

77
<ul class="toc">
88
<li><a href="#documents-vs-models">Documents vs Models</a></li>
@@ -134,7 +134,7 @@ await Person.updateOne({}, { age: 'bar' });
134134
await Person.updateOne({}, { age: -1 }, { runValidators: true });
135135
```
136136

137-
Read the [validation](./validation.html) guide for more details.
137+
Read the [validation](validation.html) guide for more details.
138138

139139
<h2 id="overwriting"><a href="#overwriting">Overwriting</a></h2>
140140

docs/faq.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ console.log(new Model());
119119

120120
**A**. This is a performance optimization. These empty objects are not saved
121121
to the database, nor are they in the result `toObject()`, nor do they show
122-
up in `JSON.stringify()` output unless you turn off the [`minimize` option](./guide.html#minimize).
122+
up in `JSON.stringify()` output unless you turn off the [`minimize` option](guide.html#minimize).
123123

124124
The reason for this behavior is that Mongoose's change detection
125125
and getters/setters are based on [`Object.defineProperty()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty).
@@ -128,11 +128,11 @@ the overhead of running `Object.defineProperty()` every time a document is creat
128128
mongoose defines properties on the `Model` prototype when the model is compiled.
129129
Because mongoose needs to define getters and setters for `nested.prop`, `nested`
130130
must always be defined as an object on a mongoose document, even if `nested`
131-
is undefined on the underlying [POJO](./guide.html#minimize).
131+
is undefined on the underlying [POJO](guide.html#minimize).
132132

133133
<hr id="arrow-functions" />
134134

135-
<a class="anchor" href="#arrow-functions">**Q**</a>. I'm using an arrow function for a [virtual](./guide.html#virtuals), [middleware](./middleware.html), [getter](./api.html#schematype_SchemaType-get)/[setter](./api.html#schematype_SchemaType-set), or [method](./guide.html#methods) and the value of `this` is wrong.
135+
<a class="anchor" href="#arrow-functions">**Q**</a>. I'm using an arrow function for a [virtual](guide.html#virtuals), [middleware](middleware.html), [getter](api.html#schematype_SchemaType-get)/[setter](api.html#schematype_SchemaType-set), or [method](guide.html#methods) and the value of `this` is wrong.
136136

137137
**A**. Arrow functions [handle the `this` keyword much differently than conventional functions](https://masteringjs.io/tutorials/fundamentals/arrow#why-not-arrow-functions).
138138
Mongoose getters/setters depend on `this` to give you access to the document that you're writing to, but this functionality does not work with arrow functions. Do **not** use arrow functions for mongoose getters/setters unless do not intend to access the document in the getter/setter.
@@ -225,7 +225,7 @@ new Schema({
225225
<a class="anchor" href="#model_functions_hanging">**Q**</a>. All function calls on my models hang, what am I doing wrong?
226226

227227
**A**. By default, mongoose will buffer your function calls until it can
228-
connect to MongoDB. Read the [buffering section of the connection docs](./connections.html#buffering)
228+
connect to MongoDB. Read the [buffering section of the connection docs](connections.html#buffering)
229229
for more information.
230230

231231
<hr id="enable_debugging" />
@@ -245,7 +245,7 @@ mongoose.set('debug', { color: false })
245245
mongoose.set('debug', { shell: true })
246246
```
247247

248-
For more debugging options (streams, callbacks), see the ['debug' option under `.set()`](./api.html#mongoose_Mongoose-set).
248+
For more debugging options (streams, callbacks), see the ['debug' option under `.set()`](api.html#mongoose_Mongoose-set).
249249

250250
<hr id="callback_never_executes" />
251251

0 commit comments

Comments
 (0)