Open existing indexedDB Database using dexie.js? - javascript

I have an existing indexedDB Database with the name of "APPV1" with version number "0.1".
indexedDB.open("APPV1", "1.0");
I want to use the dexie.js wrapper for indexedDB.
My question was how can I open the existing DB with dexie?
How can I add tables with existing DB with dexie?
How can I access data's with the help of dexie?
Note: I read their documentation and I'm not sure about how can they access the existing indexedDB using dexie.js

This topic should be covered here: https://dexie.org/docs/Tutorial/Migrating-existing-DB-to-Dexie
Edit: I just now updated dump-databases.html to allow converting a non-dexie database into Dexie code. (This was not needed before but since chromium removed the webkitGetDatabaseNames() API). So if your DB is created outside Dexie, press the Add Database button and enter the name of the DB to be able to dump it.

Related

Google apps script CAN'T store attachment addons

I would like to know how to store something when you use check box and later access it when checkbox state changes.
I tried store array as global but when script runs again what i stored is reseted to empty array.
I also tried propeties but it can only store strings.
So if anybody know how to store attachments i would be glad.
There are lots of ways on how this can be approached. Either you can store data to a spreadsheet and build scripts based on the Google Sheet Data by referring to this document.
If it's a file were talking about you can use DriveApp using the method createFile() from a given Blob of arbitrary data. Documentation here.
Or, you can connect to an external database using JDBC Service as reference here in this documentation.

I can recover original data after modifying it with ".update" in Firebase Cloud Firestore?

I am using the Firebase Cloud Firestore database with JavaScript and Node.js.
I accidentally modified a document inside collection that contained very important data.
I did this using the .update method as explained in the Update a document section of the official Firebase documentation.
The point is that since I was using test data, when modifying the document I did not update its data correctly, but rather I overwritten the original information with the test data.
Since I didn't do any kind of backup of that data, my question is ...
Is there a way to get back the original data that I overwritten using the '.update'?
Firestore does not automatically keep back ups of your data, so unless you set up an automatic export of the data yourself the previous contents of the document are lost.
If this is business critical data, you could try reaching out to Firebase support for personalized help in troubleshooting. But since you said it's test data, the better path is likely to figure out how to set up your test data automatically in a way that makes it reproducible in case of a coding mistake like this one.

Full CRUD app without a database possible?

If I use a json file stored in one of my GitHub repos as a mock backend, I know how to fetch and read all the data. Is it also possible to edit or post new data to this json file? Would an alternative mock backend like Mocky.io be a better solution (to achieve full CRUD)?
I think you could store the information inside csv files or somehting like that, you would be recreating a database engine as MongoDB & create your own reader to find the info, or you could store the users info using local Storage,
However this would make your app very limited.
Here's the link for the documentation of local storage
https://developer.mozilla.org/es/docs/Web/API/Window/localStorage
Well if you want to try out CRUD operations you can use free JSON APIs like http://jsonplaceholder.typicode.com/ or
https://mockfirst.com/
where you can create, read, update and delete data using various api end points. It is better to go this way first then you could move on to updating a JSON file.
(UPDATE)
You can use https://jsonbin.io/
Here you can place your own data and use it as an API.

Replace Appcelerator Application database on iOS

Hy, I have an iOS application (only for iOS) developed in Titanium Appcelerator using JavaScript.
I'm trying to use SQLite data bases in my app.
I was able to copy my SQLite database to my project with this:
Ti.Database.install('/baseDados/aquarismo', 'AquaInfo');
This "/baseDados/aquarismo" is the database directory inside my project, and "AquaInfo" is the name of the database after copying it.
Then I can open and close my database to get my data from it.
My problem is when I update my SQLite database I need to update it inside my project. So I replace my database inside my project folder with the new database.
But then I need to delete the old database when my app starts and replace it whit the new one.
I have tried this:
var f = Ti.Filesystem.getFile(
Ti.Filesystem.applicationSupportDirectory, 'database','AquaInfo.sql');
//If it's there, delete it
if(f.exists() == true){
f.deleteFile();
}
// Install fresh database
Ti.Database.install('/baseDados/aquarismo','AquaInfo');
However the database doesn't get replaced by the new one.
How can I update my SQLite database when my iOS app starts?
Whenever you update database whether update your table column or create new table and save your changes, new "AquaInfo.sqlite" file generated.
So we have to replace it because we are updating database from external source.
Solution:
If you want database changes at application starting point. You have to write code manually like create table, add column in manual created table and change data type of certain column.
So you can achieve this via manually write code for creating table and related stuff.

SpagoBI data set: use javascript to access to MongoDB data base

Since data set in SpagoBI could be created using scripts, I need to connect, query my MongoDB data base using javascript (or Groovy).
I need to use scripts to be able to execute aggregation on the mongoDB data, I can't use aggregation directly on my MongoDB because my data type is String
I dont know how to access my Database using scripts
Any ideas?
You should create a Mongo dataset. The steps to create are:
Step1: Create a Mongo datasource in the administrator console. Notes: the type must be JDBC and the value for Class input field must be "mongo"
JDBC: {unit_host}:{port}/${db}
CLASS: mongo
Step2: now you can create a dataset. The procedure is the same of the query datasets. The difference here is the language.. JS instead of SQL.
Take a look at the SpagoBI wiki in particolar here: http://wiki.spagobi.org/xwiki/bin/view/spagobi_server/data_set#HQueryDataSet28Mongo29
When connecting to mongoDB, you pass auth stuff in the url. Since the scripts lies on the client side, it would be hard to make the connection secure (unless you are talking about backend JavaScript). Anybody would be able to see how to connect to your DB and for instance delete all content.
I would suggest a simple api to interface the database. Then u control the access to what a user can do towards the database.
Or have I misunderstood the scenario?

Categories

Resources