@xuda.io/xuda-dbs-plugin-xuda 1.0.166 → 1.0.168

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/studio.mjs +10 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/xuda-dbs-plugin-xuda",
3
- "version": "1.0.166",
3
+ "version": "1.0.168",
4
4
  "description": "Xuda Database Socket for Xuda's proprietary structure powered by CouchDB",
5
5
  "scripts": {
6
6
  "pub": "npm version patch --force && npm publish --access public"
package/studio.mjs CHANGED
@@ -533,6 +533,14 @@ const get_opt = function (e, table_obj) {
533
533
  opt.selector["docType"] = "database";
534
534
  opt.selector.stat = e.archived ? 4 : 3;
535
535
 
536
+ // fill selector with sort field if not exist
537
+ for (let val of opt.sort) {
538
+ let field_id = Object.keys(val)[0];
539
+ if (opt.selector[field_id]) {
540
+ opt.selector[field_id] = { $gt: null };
541
+ }
542
+ }
543
+
536
544
  opt.fields.push("_id");
537
545
  opt.fields.push("_rev");
538
546
 
@@ -788,7 +796,8 @@ const query_db = async function (e, db, table_obj) {
788
796
  };
789
797
 
790
798
  for (let val of _sort) {
791
- mango_index_obj.index.fields.push(Object.keys(val)[0]);
799
+ let field_id = Object.keys(val)[0];
800
+ mango_index_obj.index.fields.push(field_id);
792
801
  }
793
802
  // mango_index_obj = {
794
803
  // index: {