docs: improvements and fixes to API route docs (#9197)
General improvements and fixes to docs around API routes
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
export const metadata = {
|
||||
title: `${pageNumber} Data Model Index`,
|
||||
title: `${pageNumber} Data Model Database Index`,
|
||||
}
|
||||
|
||||
# {metadata.title}
|
||||
|
||||
In this chapter, you’ll learn how to define indices on a data model.
|
||||
In this chapter, you’ll learn how to define a database index on a data model.
|
||||
|
||||
## Define Index on Property
|
||||
## Define Database Index on Property
|
||||
|
||||
Use the `index` method on a property's definition to define an index.
|
||||
Use the `index` method on a property's definition to define a database index.
|
||||
|
||||
For example:
|
||||
|
||||
@@ -36,9 +36,9 @@ In this example, you define an index on the `name` property.
|
||||
|
||||
---
|
||||
|
||||
## Define Index on Data Model
|
||||
## Define Database Index on Data Model
|
||||
|
||||
A data model has an `indexes` method that defines indices on its properties.
|
||||
A data model has an `indexes` method that defines database indices on its properties.
|
||||
|
||||
The index can be on multiple columns (composite index). For example:
|
||||
|
||||
@@ -95,7 +95,7 @@ const MyCustom = model.define("my_custom", {
|
||||
export default MyCustom
|
||||
```
|
||||
|
||||
The index object passed to `indexes` accepts a `where` property that is an object of conditions. The object's key is a property's name, and its value is the condition on that property.
|
||||
The index object passed to `indexes` accepts a `where` property whose value is an object of conditions. The object's key is a property's name, and its value is the condition on that property.
|
||||
|
||||
In the example above, the composite index is created on the `name` and `age` properties when the `age`'s value is `30`.
|
||||
|
||||
@@ -130,7 +130,7 @@ A property's value in `where` can be an object having a `$ne` property. `$ne`'s
|
||||
|
||||
In the example above, the composite index is created on the `name` and `age` properties when `age`'s value is not `null`.
|
||||
|
||||
### Unique Data Model Index
|
||||
### Unique Database Index
|
||||
|
||||
The object passed to `indexes` accepts a `unique` property indicating that the created index must be a unique index.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user