diff --git a/docs/errors.md b/docs/errors.md index 883f143..b959b35 100644 --- a/docs/errors.md +++ b/docs/errors.md @@ -5,7 +5,7 @@ nav_order: 6 # Error Responses -All monastery [model operations](/model/#table-of-contents) return errors in the [JSON API error specification](https://jsonapi.org/format/#errors) format. Error object(s) are always returned in an array. +All monastery [model operations](./model/#table-of-contents) return errors in the [JSON API error specification](https://jsonapi.org/format/#errors) format. Error object(s) are always returned in an array. ### Example diff --git a/docs/manager/index.md b/docs/manager/index.md index e9361c1..9ac9116 100644 --- a/docs/manager/index.md +++ b/docs/manager/index.md @@ -13,7 +13,7 @@ Monastery constructor, same as the [monk constructor](https://automattic.github. 1. `uri` *(string\|array)*: A [mongo connection string URI](https://docs.mongodb.com/manual/reference/connection-string/). Replica sets can be an array or comma separated. 2. [`options`] *(object)*: - - [`defaults`] *(boolean)*: see [model.insert](/model/insert.html#defaults-example) + - [`defaults`] *(boolean)*: see [model.insert](../model/insert.html#defaults-example) - [`mongo options`](http://mongodb.github.io/node-mongodb-native/3.2/reference/connecting/connection-settings/)... 3. [`callback`] *(function)*: You may optionally specify a callback which will be called once the connection to the mongo database is opened or throws an error. diff --git a/docs/manager/model.md b/docs/manager/model.md index 1c67cba..7a9fc63 100644 --- a/docs/manager/model.md +++ b/docs/manager/model.md @@ -11,7 +11,7 @@ Sets up a model, retrieves a collection, and sets up any required indexes 1. `name` *(string)*: name of the mongo collection -2. [`schema`] *(object)*: [Schema](/schema) (and collection level options) +2. [`schema`] *(object)*: [Schema](../schema) (and collection level options) ### Returns diff --git a/docs/model/findOne.md b/docs/model/findOne.md index 2a67d1e..3a8bc5f 100644 --- a/docs/model/findOne.md +++ b/docs/model/findOne.md @@ -9,7 +9,7 @@ Find a single document and call related hook: `schema.afterFind` ### Arguments -Same argument signature as [`model.find`](/model/find). +Same argument signature as [`model.find`](./find). ### Returns diff --git a/docs/model/index.md b/docs/model/index.md index 4c20e5d..6af415e 100644 --- a/docs/model/index.md +++ b/docs/model/index.md @@ -6,7 +6,7 @@ has_children: true # Model -Created via [`manager.model`](/manager/model). +Created via [`manager.model`](../manager/model). Models inherit most of the [monk collection](https://automattic.github.io/monk/docs/collection/) instance methods. diff --git a/docs/model/insert.md b/docs/model/insert.md index e7d5582..8418279 100644 --- a/docs/model/insert.md +++ b/docs/model/insert.md @@ -27,7 +27,7 @@ user.insert({ data: [{ name: 'Martin Luther' }, { name: 'Bruce Lee' }]}) ### Defaults example -When inserting, undefined subdocuments and arrays will default to `{}` `[]` respectively. You can enable `defaults` via the [manager options](/manager#arguments). +When defaults is enabled, undefined subdocuments and arrays will default to `{}` `[]` respectively when inserting. You can enable `defaults` via the [manager options](../manager#arguments). ```js db.model({ fields: { diff --git a/docs/readme.md b/docs/readme.md index 567bc19..0d5b822 100644 --- a/docs/readme.md +++ b/docs/readme.md @@ -5,12 +5,11 @@ ## Features * User friendly API design, built around the awesome [Monk](https://automattic.github.io/monk/) -* Simple CRUD methods with model population +* Simple CRUD operations with model population * Model validation deriving from your schema * Custom error messages can be defined in your schema -* Error response ready for client consumption -* Automatic index setup -* Lightweight +* Normalised error responses ready for client consumption +* Automatic mongodb index setup ## Install @@ -32,7 +31,7 @@ db.model('user', { fields: { name: { type: 'string' }, pets: [{ type: 'string' }], - address: { city: { type: 'string', minLength: 20 } }, + address: { city: { type: 'string', minLength: 10 } }, points: [[{ type: 'number' }]] } }) @@ -68,4 +67,3 @@ Coming soon... ## License Copyright 2019 Ricky Boyce. Code released under the MIT license. - diff --git a/docs/schema.md b/docs/schema.md index 025c6f3..fc9872f 100644 --- a/docs/schema.md +++ b/docs/schema.md @@ -21,7 +21,7 @@ Model schema object. 1. Fields may contain subdocuments, array of values, or an array of subdocuments 2. Field values need to have the `type` rule defined -3. Field values can contain [custom](#custom-validation-rules) and [default validation rules](/rules), e.g. `{ minLength: 2 }` +3. Field values can contain [custom](#custom-validation-rules) and [default validation rules](./rules), e.g. `{ minLength: 2 }` 4. Field values can contain [field options](#field-options). ```js