Add an in-memory TaffyDB database.
Memory Molecule | |
Preference Dialog | |
Comments | Memory molecule recognizes Comma-Separated Values (CSV) formated files. |
Properties | |
type | string, ( r ) |
pref.name | string, ( r ) |
pref. | bool, ( r, w ) |
dataSet | object, ( r ) |
Functions | |
attach | |
detach | |
delete | |
rename | |
clone | |
serialize | |
save |
Memory molecule recognizes Comma-Separated Values (CSV) formated files. To import csv records into the database, simply drag a csv file from your desktop to your private vault and then drag that file to a droplet.
The first row of the CSV file must be the header fields. If a field contains a field delimiter, namely the comma, that field must be double quoted.
Once imported, you can use dataSet property of this molecule to access data records. Example usages include,
// Find all the states with population less than or equal to 5 million this.molecule.dataSet({Population:{lte:5}});
// Find California's record by abbreviation this.molecule.dataSet({State:"CA"});
// Maryland state recode var maryland = this.molecule.dataSet({State:"MD"}).first();
// maryland's population var population = maryland.Population;
// Get an array of state names var states = this.molecule.dataSet().select("Name");
// Get an array of distinct state abbreviation var states = this.molecule.dataSet().distinct("State");
// Apply a function to all the states this.molecule.dataSet().each(function (r) { alert(r.Name + "!"); });
// Change Virginia's population this.molecule.dataSet({State:"VA"}).update({Population:9.3});
// Remove Wisconsin this.molecule.dataSet({Name:"Wisconsin"}).remove();
// insert a new state this.molecule.dataSet.insert({"Name":"Georgia","State":"GA","Population":12.4});
this.molecule.save();
Note: only the owner of this molecule can save (write privilege.) Furthermore, if you are using someone else’s memory molecule and its private flag is set to true by the owner, you will not be able read its data (no read privilege.)
For More detailed information on how to write queries, please visit this page at TaffyDB web site.
string, ( r )
The scriptable name for this molecule. This name can be set using rename function dynamically.
bool, ( r, w )
Designate this database to be private. Others will not have read access. After modifying this flag, you must call save to put it in effect. Default to false.