diff --git a/docs/reference/collection.md b/docs/reference/collection.md
index f5a0d974d7..46f9f1882d 100644
--- a/docs/reference/collection.md
+++ b/docs/reference/collection.md
@@ -219,19 +219,27 @@ await field.sync();
interface updateOptions {
(options: CollectionOptions): void;
}
+
+interface CollectionOptions extends Sequelize.ModelOptions {
+ name: string;
+ tableName?: string;
+ fields?: any;
+ model?: string | Model;
+ repository?: string | Repository;
+ [key: string]: any;
+}
```
##### Examples
+可能的更新项详见 [Sequelize.ModelOptions](https://github.com/sequelize/sequelize/blob/f9dfaa7c533acad4ae88fd16b47c3a5805fb6e9b/types/lib/model.d.ts#L1390)
+
```ts
const collection = db.collection({
name: 'tests',
});
collection.updateOptions({
- createdAt: true,
- updatedAt: true,
- sortable: true,
- fields: [],
+
});
```
diff --git a/docs/reference/database.md b/docs/reference/database.md
index 8fb48b3e70..d8cef8a12f 100644
--- a/docs/reference/database.md
+++ b/docs/reference/database.md
@@ -144,7 +144,7 @@ try {
##### Examples
-## `db.getCollection()`
+## `db.getCollection()` 待完善
##### Definition
@@ -160,7 +160,7 @@ class Database {
const collection = db.getCollection('tests');
```
-## `db.hasCollection()`
+## `db.hasCollection()` 待完善
##### Definition
@@ -178,7 +178,7 @@ if (db.hasCollection('tests')) {
}
```
-## `db.import()`
+## `db.import()` 待完善
##### Definition
@@ -207,12 +207,49 @@ db.import({
});
```
-## `db.on()`
+## `db.on()` 待完善
##### Definition
+collection 的事件(都是同步的)
+
+- `beforeDefineCollection`
+- `afterDefineCollection`
+- `beforeUpdateCollection`
+- `afterUpdateCollection`
+- `beforeRemoveCollection`
+- `afterRemoveCollection`
+
+model 的事件(异步的)
+
+- `.`
+
##### Examples
+全局事件
+
+```ts
+db.on('beforeDefineCollection', (options: CollectionOptions) => {
+
+});
+
+db.on('afterDefineCollection', (collection: Collection) => {
+
+});
+
+db.on('afterCreate', async (model, options) => {
+
+});
+```
+
+特定 model 事件
+
+```ts
+db.on('posts.afterCreate', async (model, options) => {
+
+});
+```
+
## `db.registerFieldTypes()`
自定义字段存储类型,更多字段类型查看 [Field Types](field-types)
@@ -248,7 +285,7 @@ db.collection({
});
```
-## `db.registerModels()`
+## `db.registerModels()` 待完善
自定义 Model
@@ -286,7 +323,7 @@ const test = Test.model.create();
test.customMethod();
```
-## `db.registerOperators()`
+## `db.registerOperators()` 待完善
自定义筛选条件
@@ -360,7 +397,7 @@ repository.find({
});
```
-## `db.registerRepositories()`
+## `db.registerRepositories()` 待完善
自定义 Repository
@@ -385,7 +422,7 @@ const Test = db.collection({
Test.repository.customMethod();
```
-## `db.removeCollection()`
+## `db.removeCollection()` 待完善
移除 collection