dexie

Dexie : How to add to array in nested object

青春壹個敷衍的年華 提交于 2021-02-08 02:56:49
问题 I am using Dexie IndexedDB wrapper and I am trying to add an object to an existing array which in inside a nested object. The structure looks similar to below { Name : 'John', age : 33, tags : { skill: [{ first: '.NET', second: 'JAVA', third: [{special1:'sleep'},{special2:'eat'}] }] } } I have tried many way to push object special3:'run' to skill.third but without success. My last attempt looked something like this const pathObject = {}; const fullPath = 'result.tags.skill[3].third';

With Dexie, can I get all objects in a table where an array field has a specific value as one of its elements?

情到浓时终转凉″ 提交于 2021-01-29 19:52:17
问题 I have a table where each object has a field that is an array of strings: for example, { people: ['John', 'Bob', 'Sue'] } . I need all objects in the table that have 'Sue' in the people array. Can Dexie do this? 回答1: Yes, using MultiEntry indexes you can do exactly that. const db = new Dexie("testdb"); db.version(2).stores({ groups: 'id, *people' }); async function addRow() { await db.groups.add({id: 1, people: ['John', 'Bob', 'Sue']}); } async function findSuesGroups() ( return await db

How to manage form submission in an Electron desktop app?

孤者浪人 提交于 2020-05-17 03:24:49
问题 I have read this question but the way to manage a form in electron is still unclear to me. Currently, I am using the code below and I want to store the data using dexie.js when a user submits the form, but I'm not able to figure out how to retrieve the data when using Vue. My main process file contains this code: // main.js const electron = require('electron'); const { app, BrowserWindow, ipcMain } = electron; function createWindow(){ let win = new BrowserWindow({ width: 800, height: 600,

get GroupBy count in Dexie

隐身守侯 提交于 2020-05-15 08:11:57
问题 I have an IndexedDB table that follows accepts following structured JSON as a row: { id : 1, name : 'doc1', createdDate : '2018-08-08' } I want to get count for each available date in the table. ie: groupby:date then count . Expected example output is in the format of: { '2018-08-08' : 5, '2018-08-18' : 19, ... } Table contains large number of records. So, how can efficiently achieve this requirement using Dexie? 回答1: If you index createdDate, const db = new Dexie("yourDB"); db.version(1)

Dexie.js not store electron form submitted data

让人想犯罪 __ 提交于 2020-04-18 03:49:21
问题 I'm not sure what's wrong, I'm trying to save my data inside a dixie.js table I've created. I'm using electron and I've binded the data to an ipc event. I can see the passed data inside the macOS terminal, I suppose that the data are available also for the main process. I have passed the data directly to dexie but I'm not able to save or get them. Here is the code. I get this error inside the macOS teminal, it's dexie related but I don't know what's wrong. **ERROR Dexie { _dbSchema: {

Is it possible to use square bracket notion in class methods?

谁说胖子不能爱 提交于 2020-01-25 04:19:48
问题 I am trying to automate running some queries with dexiejs but i can get them to work when i create a JavaScript function. The queries simply don't run... if i want to update i get: Promise.js:840 Unhandled rejection: TypeError: Cannot read property 'update' of undefined And the rest of my functionalities i.e delete follow the same path i wrote a simple jsfiddle to demostrate my problem <!doctype html> <html> <head> <!-- Include Dexie --> <script src="https://unpkg.com/dexie@latest/dist/dexie

React - show hide two elements without flickering on page load

删除回忆录丶 提交于 2020-01-14 10:26:14
问题 Edit. I rewrote the code to be even more minimalist. The below code is a spike test of my issue. Here is a video of the issue: https://imgur.com/a/WI2wHMl I have two components. The first component is named TextEditor (and it is a text editor) but its content is irrelevant - the component could be anything. A simple div with text would be just as relevant. The next component is named Workflows and is used to render a collection from IndexDB (using the Dexie.js library). I named this

Reopen Dexie Database with Tampermonkey

扶醉桌前 提交于 2020-01-06 10:04:12
问题 As per my previous post, I was referred to create a new post. As seen in the comments, there is a trail of progression for the issue, I'll rephrase here in this post: I'm using a TamperMonkey script in FireFox. I'm trying to persist a Dexie object/database into TamperMonkey's local storage with GM.setValue('unique-dexie-db-name', dexieDBvariable); However when I go to retrieve this value (ex. I store this on google.com, and retrieve this on yahoo.com) with var dexieDB = GM.getValue('unique

How to migrate existing Dexie database to new Dexie database or How to rename Dexie database?

五迷三道 提交于 2019-12-11 15:13:47
问题 I have web application which uses Dexie wrapper for indexedDB, for some reason i need to rename existing Database with no glitch, i couldn't find renaming on Dexie documentation. 回答1: There's no support to rename a database is neither Dexie or native indexedDB. But you can clone a database using the following piece of code (not tested): function cloneDatabase (sourceName, destinationName) { // // Open source database // const origDb = new Dexie(sourceName); return origDb.open().then(()=> { //

Dexie.js Autoincrement Primary Key - does it ever reset? How to reset it?

南楼画角 提交于 2019-12-11 10:07:04
问题 In Dexie.js you can create a store with an auto-incrementing key let db = new Dexie("nav_api"); db.version(1).stores({ jobs: '++id, json' }); So to test, I created 14 objects in the db via db.jobs.put({json: '[]'}) , and all their keys came out as expected, started at 1 up to 14. Then deleted some of the later ones, db.jobs.where('id').above(6).delete() , and added another one to the db, and its index was 15. Is there any way to reset the index to 0? I was using it for ordering, and I'm not