Skip to content

Commit

Permalink
Update schema.md
Browse files Browse the repository at this point in the history
  • Loading branch information
royrico authored and ejscribner committed Jun 10, 2024
1 parent 66003f8 commit c05a5c6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions docusaurus/docs/basic/schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ console.log(dogs);
- Overwriting a default Ottoman document method may lead to unpredictable results.
- The example above uses the `Schema.methods` object directly to save an instance method.

::: danger Note
:::danger Note
Do **not** declare _methods_ using ES6 arrow functions (`=>`). Arrow functions [explicitly prevent binding](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions) `this`, so your method will **not** have access to the document, and the above examples will not work.
:::

Expand Down Expand Up @@ -813,7 +813,7 @@ will get:
ImmutableError: Field 'cardNumber' is immutable and current cast strategy is set to 'throw'
```

::: tip NOTE
:::tip NOTE
Ottoman's immutability only applies to `document` that have already been saved to the database.
```ts
// Define schema
Expand Down Expand Up @@ -973,7 +973,7 @@ boeing.add(plane);
boeing.add({ status: Boolean });
```

::: tip
:::tip
When a schema is added, the following properties are copied: fields, statics, indexes, methods, and hooks. Properties that already exist in the schema (fields, statics, indexes, methods) are overwritten by those of the added schema, except for hooks that are combined.
:::

Expand Down

0 comments on commit c05a5c6

Please sign in to comment.