diff options
| author | Sean Fridman <fridman@mail.sfsu.edu> | 2015-04-13 13:46:21 -0400 |
|---|---|---|
| committer | Sean Fridman <fridman@mail.sfsu.edu> | 2015-04-13 13:46:24 -0400 |
| commit | 443237393f34532c205cfd4e0d566c90ff4436d7 (patch) | |
| tree | bec85c63835a0d2549d86b42e967b0777b3b6904 /app | |
| parent | 5b7e5a133e5326a98b974b7e9e390ac393d1a05e (diff) | |
Fix autoincrement bug
max index wasn't being resolved correctly
Diffstat (limited to 'app')
| -rw-r--r-- | app/node_modules/okdb/index.js | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/app/node_modules/okdb/index.js b/app/node_modules/okdb/index.js index 85156d1..5aa22a2 100644 --- a/app/node_modules/okdb/index.js +++ b/app/node_modules/okdb/index.js @@ -180,7 +180,7 @@ FSDB.prototype.getMeta = function() { */ function autoincrement(wrapper, schema, data) { return schema.autoIncrementFields.reduce(function(data, field) { - var last = wrapper.chain().sort(field).first().value(); + var last = wrapper.chain().sortByOrder([field], [true]).last().value(); var index = last ? last[field] : -1; var incremented = {}; incremented[field] = (parseInt(index) + 1); |
