Skip to content

Commit b02a579

Browse files
authoredJun 26, 2022
docs: update doc (feats: #174)
1 parent 4a3cc98 commit b02a579

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed
 

‎README.md

+18-18
Original file line numberDiff line numberDiff line change
@@ -361,24 +361,6 @@ Model.paginate({}, options, function (err, result) {
361361
});
362362
```
363363

364-
#### AllowDiskUse for large datasets
365-
366-
Sets the allowDiskUse option, which allows the MongoDB server to use more than 100 MB for query. This option can let you work around `QueryExceededMemoryLimitNoDiskUseAllowed` errors from the MongoDB server.
367-
368-
**Note that this option requires MongoDB server >= 4.4. Setting this option is a no-op for MongoDB 4.2 and earlier.**
369-
370-
```js
371-
const options = {
372-
limit: 10,
373-
page: 1,
374-
allowDiskUse: true,
375-
};
376-
377-
Model.paginate({}, options, function (err, result) {
378-
// Result
379-
});
380-
```
381-
382364
### Pagination for sub documents
383365

384366
If you want to paginate your sub-documents, here is the method you can use.
@@ -401,6 +383,24 @@ var option = {
401383
const result = await Book.paginateSubDocs(query, option);
402384
```
403385

386+
#### AllowDiskUse for large datasets
387+
388+
Sets the allowDiskUse option, which allows the MongoDB server to use more than 100 MB for query. This option can let you work around `QueryExceededMemoryLimitNoDiskUseAllowed` errors from the MongoDB server.
389+
390+
**Note that this option requires MongoDB server >= 4.4. Setting this option is a no-op for MongoDB 4.2 and earlier.**
391+
392+
```js
393+
const options = {
394+
limit: 10,
395+
page: 1,
396+
allowDiskUse: true,
397+
};
398+
399+
Model.paginate({}, options, function (err, result) {
400+
// Result
401+
});
402+
```
403+
404404
Below are some references to understand more about preferences,
405405

406406
- https://github.com/Automattic/mongoose/blob/master/lib/query.js#L1008

0 commit comments

Comments
 (0)
Please sign in to comment.