erikolson186 / zangodb

MongoDB-like interface for HTML5 IndexedDB
https://erikolson186.github.io/zangodb/
MIT License
1.07k stars 72 forks source link

TypeError: #<Object> is not a function #39

Open sandorvasas opened 3 years ago

sandorvasas commented 3 years ago

Why does the following code produce the error in the title?

(async () => {
  let res = await window.db.collection('change_queue')
              .find({})
              .sort({timestamp: -1})
  res = await res.toArray()
  console.log("RES", res)
})()

typeof timestamp is Date btw. Seems to be working without the sort() part

billypon commented 2 years ago

@sandorvasas

zangodb+1.0.8.patch

diff --git a/node_modules/zangodb/build/src/create_next_fn.js b/node_modules/zangodb/build/src/create_next_fn.js                                                                                                                                                              
index f06829b..d507816 100644
--- a/node_modules/zangodb/build/src/create_next_fn.js
+++ b/node_modules/zangodb/build/src/create_next_fn.js
@@ -4,7 +4,7 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol

 var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length =

-var merge = require('deepmerge');
+var merge = require('deepmerge').default;

 var _require = require('./util.js');
danielgwood commented 2 years ago

@billypon thanks for the patch, it works well for me.