Skip to content

Commit

Permalink
Update model.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 c05a5c6 commit 18f6225
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions docusaurus/docs/basic/model.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const schema = new Schema({ name: String, age: Number });
const User = model('User', schema, { collectionName: 'users' });
```

::: tip Defining Collection Name
:::tip Defining Collection Name
Models will be mapped to your Collections, if no Collection name option is provided then the Collection name will be equal to the Model name.
There is an exception to this rule:

Expand Down Expand Up @@ -97,7 +97,7 @@ const User = model('User', schema, { collectionName: 'users', idKey: '__id' });

The above example will override the default `id` with `__id`, now for the `User`'s documents you can get the `id` value from doc.\_\_id.

::: tip
:::tip
You can also get the `id` value by calling the `doc._getId()` methods, regardless of the `id` property name.
:::

Expand Down Expand Up @@ -130,7 +130,7 @@ See the [API](/docs/api/interfaces/imodel.html#static-createmany) docs for more
User.createMany([{ name: 'John' }, { name: 'Jane' }]);
```

::: tip
:::tip
The response status will be **SUCCESS** as long as no error occurs, otherwise it will be **FAILURE**.
:::

Expand Down Expand Up @@ -277,7 +277,7 @@ $> Documents: [
]
```

::: tip Note
:::tip Note
Using `ignoreCase` as part of find functions options will always prioritize the value of `$ignoreCase` defined in the clause

```typescript
Expand Down Expand Up @@ -325,7 +325,7 @@ console.log(normalDoc instanceof Object); // true
console.log(normalDoc.constructor.name === '_Model'); // true
```

::: tip NOTE
:::tip NOTE
The downside of enabling `lean` is that lean docs don't have:
- Change tracking
- Casting and validations
Expand Down Expand Up @@ -467,7 +467,7 @@ _Model {

> If we try to call `userWithLean.toJSON()` will get `TypeError: userWithLean.toJSON is not a function`
::: tip NOTE
:::tip NOTE

When document to populate does not exist, the corresponding id is kept:

Expand Down Expand Up @@ -539,7 +539,7 @@ See the [API](/docs/api/interfaces/imodel.html#static-removemany) docs for more
User.removeMany({ name: { $like: '%JohnDoe%' } });
```

::: tip
:::tip
The response status will be **SUCCESS** as long as no error occurs, otherwise it will be **FAILURE**.
:::

Expand Down Expand Up @@ -571,7 +571,7 @@ See the [API](/docs/api/interfaces/imodel.html#static-updatemany) docs for more
User.updateMany({ name: { $like: '%JohnDoe%' } }, { name: 'John' });
```

::: tip
:::tip
The response status will be **SUCCESS** as long as no error occurs, otherwise it will be **FAILURE**.
:::

Expand All @@ -582,7 +582,7 @@ See the [API](/docs/api/interfaces/imodel.html#static-findoneandupdate) docs for
User.findOneAndUpdate({ name: { $like: '%John Doe%' } }, { name: 'John' }, { new: true, upsert: true });
```

::: tip
:::tip
By default the option **new** and **upsert** are **false**

If options.new is **true** return the document after update otherwise by default return the document before update.
Expand Down

0 comments on commit 18f6225

Please sign in to comment.