dobo 1.2.8 → 1.2.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -34,6 +34,7 @@ async function factory (pkgName) {
34
34
  filter: {
35
35
  limit: 25,
36
36
  maxLimit: 200,
37
+ hardLimit: 10000,
37
38
  sort: ['dt:-1', 'updatedAt:-1', 'updated_at:-1', 'createdAt:-1', 'createdAt:-1', 'ts:-1', 'username', 'name']
38
39
  },
39
40
  idField: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dobo",
3
- "version": "1.2.8",
3
+ "version": "1.2.9",
4
4
  "description": "Database ORM/ODM for Bajo Framework",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1,14 +1,22 @@
1
1
  async function findAll (name, filter = {}, options = {}) {
2
+ const { maxLimit, hardLimit } = this.config.default.filter
2
3
  filter.page = 1
3
- filter.limit = 100
4
+ filter.limit = maxLimit
4
5
  options.dataOnly = true
5
6
  const match = filter.match
6
7
  const all = []
8
+ let count = 0
7
9
  for (;;) {
8
10
  filter.match = match
9
11
  const results = await this.recordFind(name, filter, options)
10
12
  if (results.length === 0) break
13
+ if (count + results.length > hardLimit) {
14
+ const sliced = results.slice(0, hardLimit - count)
15
+ all.push(...sliced)
16
+ break
17
+ }
11
18
  all.push(...results)
19
+ count = count + results.length
12
20
  filter.page++
13
21
  }
14
22
  return all