SlideShare a Scribd company logo
1 of 51
Better Data Management
       with TaffyDB

       taffydb.com
Who here considered
 themselves a JavaScript
Programmer 5 years ago?
Three Types of JavaScript Developer
Three Types of JavaScript Developer
Three Types of JavaScript Developer
Three Types of JavaScript Developer
Three Types of JavaScript Developer
Three Types of JavaScript Developer
It all started with arrays
It all started with arrays

var todos = [
    [quot;Home To Dosquot;,1,false,[
       [quot;Replace light bulbsquot;,false,quot;Ianquot;],
       [quot;Clean out deskquot;,false,quot;Ianquot;]]
    ],
    [quot;Work To Dosquot;,0,true,[
       [quot;Fix bug with formquot;,false,quot;Ianquot;],
       [quot;Draft requirements docquot;,false,quot;Ianquot;],
       [quot;Learn JavaScript Objectsquot;,false,quot;Ianquot;]]
    ]
];
It all started with arrays

var todos = [
     [quot;Home To Dosquot;,1,false,[
        [quot;Replace light bulbsquot;,false,quot;Ianquot;],
        [quot;Clean out deskquot;,false,quot;Ianquot;]]
     ],
     [quot;Work To Dosquot;,0,true,[
        [quot;Fix bug with formquot;,false,quot;Ianquot;],
        [quot;Draft requirements docquot;,false,quot;Ianquot;],
        [quot;Learn JavaScript Objectsquot;,false,quot;Ianquot;]]
     ]
];
// update Fix bug with form to complete
todos[1][3][0][1] = true;
Functions like this

function checkTask (list,task) {
   for(var li = 0;li<todos;li++) {
      if (todos[li][0] == list) {
          for (var ta = 0; ta < todos[li][3]; ta++) {
             if (todos[li][3][ta][0] == task) {
                 todos[li][3][ta][1] == true;
             }
          }
      }
   }
}
checkTask(quot;Work To Dosquot;,quot;Draft requirements docquot;);
JavaScript Object Literals




                   {}
JavaScript Object Literals

Useful for storing related name value pairs:

     {country:quot;United Statesquot;,
     government:quot;Democracyquot;,
     president:quot;Barrak Obamaquot;}
JavaScript Object Literals

Useful for storing related name value pairs:

     {country:quot;United Statesquot;,
     government:quot;Democracyquot;,
     president:quot;Barrak Obamaquot;}

Also useful for composing instructions for functions:

find({government:quot;Democracyquot;})
// find all records where government == Democracy
This is TaffyDB
This is TaffyDB

• A wrapper for object literals (records)
This is TaffyDB

• A wrapper for object literals (records)
• Provides a JavaScript centric API (using arrays/objects)
This is TaffyDB

• A wrapper for object literals (records)
• Provides a JavaScript centric API (using arrays/objects)
• Uses familiar database concepts
This is TaffyDB

•   A wrapper for object literals (records)
•   Provides a JavaScript centric API (using arrays/objects)
•   Uses familiar database concepts
•   But it isn't a DB - no persistence
This is TaffyDB

•   A wrapper for object literals (records)
•   Provides a JavaScript centric API (using arrays/objects)
•   Uses familiar database concepts
•   But it isn't a DB - no persistence

•   Thin (under 12K)
•   Opensource and Free
•   Maintained (v1.7.1)
•   One global object, no prototype modification
Create a data collection


// create a populated data collection
var jsConfSpeakers = TAFFY([
    {quot;namequot;:quot;John Resigquot;,quot;topicquot;:quot;Surprise!quot;},
    {quot;namequot;:quot;Francisco Tolmaskquot;,quot;topicquot;:quot;Objective-Jquot;},
    {quot;namequot;:quot;Chris Andersonquot;,quot;topicquot;:quot;CouchDBquot;},
    {quot;namequot;:quot;Jeff Hayniequot;,quot;topicquot;:quot;Web Apps on the Desktopquot;},
    {quot;namequot;:quot;Stoyan Stefanovquot;,quot;topicquot;:quot;Kick Ass Web Appsquot;}
]);
Insert




jsConfSpeakers.insert(
   {quot;namequot;:quot;Richard D. Worthquot;,quot;topicquot;:quot;jQuery UIquot;}
 );
Getting records


jsConfSpeakers.first();
// returns {quot;namequot;:quot;John Resigquot;,quot;topicquot;:quot;Surprise!quot;}
Getting records


jsConfSpeakers.first();
// returns {quot;namequot;:quot;John Resigquot;,quot;topicquot;:quot;Surprise!quot;}
// TaffyDB filtering is overloaded
// 0 and [0] will both return the first record

jsConfSpeakers.get(0);
jsConfSpeakers.get([0]);
// returns [{quot;namequot;:quot;John Resigquot;,quot;topicquot;:quot;Surprise!quot;}]
Remove

// delete is a reserved word
// use remove function instead

jsConfSpeakers.remove(0);
Update


jsConfSpeakers.update({quot;topicquot;:quot;TBDquot;},0);
// updates the first record, sets topic = quot;TBDquot;
Advanced filtering

// Use Object Literals to construct quot;where clausesquot;

jsConfSpeakers.find({name:quot;Chris Andersonquot;});
// returns [2]
Advanced filtering

// Use Object Literals to construct quot;where clausesquot;

jsConfSpeakers.find({name:quot;Chris Andersonquot;});
// returns [2]
jsConfSpeakers.find({topic:{like:quot;Web Appsquot;}});
// returns [3,4]
Advanced filtering

// Use Object Literals to construct quot;where clausesquot;

jsConfSpeakers.find({name:quot;Chris Andersonquot;});
// returns [2]
jsConfSpeakers.find({topic:{like:quot;Web Appsquot;}});
// returns [3,4]

jsConfSpeakers.find({
         topic:{like:quot;Web Appsquot;},
         name:{like:quot;Jeffquot;}});
// returns [3]
// quot;where topic like Web Apps and name like Jeffquot;
Let's see it in action...
.forEach() in details

collection.forEach(
  function (r,index) {
      //whatever logic here
  },[optional filter]);
.forEach() in details

collection.forEach(
  function (r,index) {
      //whatever logic here
  },[optional filter]);


// modify r and return it to update the record
collection.forEach(
   function (r,index) {
       r.field = quot;new valuequot;;
       return r;
   });
TaffyDB is Batteries Included
TaffyDB is Batteries Included

Events:
• onUpdate, onInsert, onRemove
TaffyDB is Batteries Included

Events:
• onUpdate, onInsert, onRemove

JSON Support
TaffyDB is Batteries Included

Events:
• onUpdate, onInsert, onRemove

JSON Support

typeOf() methods
TaffyDB is Batteries Included

Events:
• onUpdate, onInsert, onRemove

JSON Support

typeOf() methods

Object Methods
• isSameObject, mergeObject, etc
TaffyDB is Batteries Included

Events:
• onUpdate, onInsert, onRemove

JSON Support

typeOf() methods

Object Methods
• isSameObject, mergeObject, etc

Utility Methods
Does it scale?
Sites Using TaffyDB
Joe's Goals (joesgoals.com)
QuoteWizard (quotewizard.com)
VitaList (vitalist.com)
MostRecent (mostrecent.net)
http://taffydb.com

Learn - Download - Find Help
      Contribute Code

More Related Content

What's hot

CPANTS: Kwalitative website and its tools
CPANTS: Kwalitative website and its toolsCPANTS: Kwalitative website and its tools
CPANTS: Kwalitative website and its toolscharsbar
 
Getting started contributing to Apache Spark
Getting started contributing to Apache SparkGetting started contributing to Apache Spark
Getting started contributing to Apache SparkHolden Karau
 
Xml processing in scala
Xml processing in scalaXml processing in scala
Xml processing in scalaKnoldus Inc.
 
Rails database optimization
Rails database optimizationRails database optimization
Rails database optimizationKarsten Meier
 
Cassandra and Spark, closing the gap between no sql and analytics codemotio...
Cassandra and Spark, closing the gap between no sql and analytics   codemotio...Cassandra and Spark, closing the gap between no sql and analytics   codemotio...
Cassandra and Spark, closing the gap between no sql and analytics codemotio...Duyhai Doan
 
Spark + Clojure for Topic Discovery - Zalando Tech Clojure/Conj Talk
Spark + Clojure for Topic Discovery - Zalando Tech Clojure/Conj TalkSpark + Clojure for Topic Discovery - Zalando Tech Clojure/Conj Talk
Spark + Clojure for Topic Discovery - Zalando Tech Clojure/Conj TalkZalando Technology
 
OData RESTful implementation
OData RESTful implementationOData RESTful implementation
OData RESTful implementationHari Wiz
 
Getting Started with React
Getting Started with ReactGetting Started with React
Getting Started with ReactNathan Smith
 
Introduction tomongodb
Introduction tomongodbIntroduction tomongodb
Introduction tomongodbLee Theobald
 
Building Data Mapper PHP5
Building Data Mapper PHP5Building Data Mapper PHP5
Building Data Mapper PHP5Vance Lucas
 

What's hot (11)

CPANTS: Kwalitative website and its tools
CPANTS: Kwalitative website and its toolsCPANTS: Kwalitative website and its tools
CPANTS: Kwalitative website and its tools
 
Getting started contributing to Apache Spark
Getting started contributing to Apache SparkGetting started contributing to Apache Spark
Getting started contributing to Apache Spark
 
Xml processing in scala
Xml processing in scalaXml processing in scala
Xml processing in scala
 
Rails database optimization
Rails database optimizationRails database optimization
Rails database optimization
 
Cassandra and Spark, closing the gap between no sql and analytics codemotio...
Cassandra and Spark, closing the gap between no sql and analytics   codemotio...Cassandra and Spark, closing the gap between no sql and analytics   codemotio...
Cassandra and Spark, closing the gap between no sql and analytics codemotio...
 
Spark + Clojure for Topic Discovery - Zalando Tech Clojure/Conj Talk
Spark + Clojure for Topic Discovery - Zalando Tech Clojure/Conj TalkSpark + Clojure for Topic Discovery - Zalando Tech Clojure/Conj Talk
Spark + Clojure for Topic Discovery - Zalando Tech Clojure/Conj Talk
 
OData RESTful implementation
OData RESTful implementationOData RESTful implementation
OData RESTful implementation
 
Getting Started with React
Getting Started with ReactGetting Started with React
Getting Started with React
 
Graphql
GraphqlGraphql
Graphql
 
Introduction tomongodb
Introduction tomongodbIntroduction tomongodb
Introduction tomongodb
 
Building Data Mapper PHP5
Building Data Mapper PHP5Building Data Mapper PHP5
Building Data Mapper PHP5
 

Similar to Manage Data and Filter Records with TaffyDB

Intro Open Social and Dashboards
Intro Open Social and DashboardsIntro Open Social and Dashboards
Intro Open Social and DashboardsAtlassian
 
Relaxing With CouchDB
Relaxing With CouchDBRelaxing With CouchDB
Relaxing With CouchDBleinweber
 
development, ruby, conferences, frameworks, ruby on rails, confreaks, actsasc...
development, ruby, conferences, frameworks, ruby on rails, confreaks, actsasc...development, ruby, conferences, frameworks, ruby on rails, confreaks, actsasc...
development, ruby, conferences, frameworks, ruby on rails, confreaks, actsasc...ActsAsCon
 
Beyond Cookies, Persistent Storage For Web Applications Web Directions North ...
Beyond Cookies, Persistent Storage For Web Applications Web Directions North ...Beyond Cookies, Persistent Storage For Web Applications Web Directions North ...
Beyond Cookies, Persistent Storage For Web Applications Web Directions North ...BradNeuberg
 
Cross Domain Web
Mashups with JQuery and Google App Engine
Cross Domain Web
Mashups with JQuery and Google App EngineCross Domain Web
Mashups with JQuery and Google App Engine
Cross Domain Web
Mashups with JQuery and Google App EngineAndy McKay
 
Boston Computing Review - Java Server Pages
Boston Computing Review - Java Server PagesBoston Computing Review - Java Server Pages
Boston Computing Review - Java Server PagesJohn Brunswick
 
How to make Ajax work for you
How to make Ajax work for youHow to make Ajax work for you
How to make Ajax work for youSimon Willison
 
Google apps script database abstraction exposed version
Google apps script database abstraction   exposed versionGoogle apps script database abstraction   exposed version
Google apps script database abstraction exposed versionBruce McPherson
 
All I Need to Know I Learned by Writing My Own Web Framework
All I Need to Know I Learned by Writing My Own Web FrameworkAll I Need to Know I Learned by Writing My Own Web Framework
All I Need to Know I Learned by Writing My Own Web FrameworkBen Scofield
 
Scala + WattzOn, sitting in a tree....
Scala + WattzOn, sitting in a tree....Scala + WattzOn, sitting in a tree....
Scala + WattzOn, sitting in a tree....Raffi Krikorian
 
Out with Regex, In with Tokens
Out with Regex, In with TokensOut with Regex, In with Tokens
Out with Regex, In with Tokensscoates
 
Couch Db.0.9.0.Pub
Couch Db.0.9.0.PubCouch Db.0.9.0.Pub
Couch Db.0.9.0.PubYohei Sasaki
 
Pascarello_Investigating JavaScript and Ajax Security
Pascarello_Investigating JavaScript and Ajax SecurityPascarello_Investigating JavaScript and Ajax Security
Pascarello_Investigating JavaScript and Ajax Securityamiable_indian
 
Integrating Flex And Rails With Ruby Amf
Integrating Flex And Rails With Ruby AmfIntegrating Flex And Rails With Ruby Amf
Integrating Flex And Rails With Ruby Amfrailsconf
 

Similar to Manage Data and Filter Records with TaffyDB (20)

Intro Open Social and Dashboards
Intro Open Social and DashboardsIntro Open Social and Dashboards
Intro Open Social and Dashboards
 
Relaxing With CouchDB
Relaxing With CouchDBRelaxing With CouchDB
Relaxing With CouchDB
 
development, ruby, conferences, frameworks, ruby on rails, confreaks, actsasc...
development, ruby, conferences, frameworks, ruby on rails, confreaks, actsasc...development, ruby, conferences, frameworks, ruby on rails, confreaks, actsasc...
development, ruby, conferences, frameworks, ruby on rails, confreaks, actsasc...
 
Beyond Cookies, Persistent Storage For Web Applications Web Directions North ...
Beyond Cookies, Persistent Storage For Web Applications Web Directions North ...Beyond Cookies, Persistent Storage For Web Applications Web Directions North ...
Beyond Cookies, Persistent Storage For Web Applications Web Directions North ...
 
Os Pruett
Os PruettOs Pruett
Os Pruett
 
Coding Ajax
Coding AjaxCoding Ajax
Coding Ajax
 
Coding Ajax
Coding AjaxCoding Ajax
Coding Ajax
 
Cross Domain Web
Mashups with JQuery and Google App Engine
Cross Domain Web
Mashups with JQuery and Google App EngineCross Domain Web
Mashups with JQuery and Google App Engine
Cross Domain Web
Mashups with JQuery and Google App Engine
 
Ajax
AjaxAjax
Ajax
 
I Feel Pretty
I Feel PrettyI Feel Pretty
I Feel Pretty
 
Boston Computing Review - Java Server Pages
Boston Computing Review - Java Server PagesBoston Computing Review - Java Server Pages
Boston Computing Review - Java Server Pages
 
How to make Ajax work for you
How to make Ajax work for youHow to make Ajax work for you
How to make Ajax work for you
 
Google apps script database abstraction exposed version
Google apps script database abstraction   exposed versionGoogle apps script database abstraction   exposed version
Google apps script database abstraction exposed version
 
All I Need to Know I Learned by Writing My Own Web Framework
All I Need to Know I Learned by Writing My Own Web FrameworkAll I Need to Know I Learned by Writing My Own Web Framework
All I Need to Know I Learned by Writing My Own Web Framework
 
Scala + WattzOn, sitting in a tree....
Scala + WattzOn, sitting in a tree....Scala + WattzOn, sitting in a tree....
Scala + WattzOn, sitting in a tree....
 
"Javascript" por Tiago Rodrigues
"Javascript" por Tiago Rodrigues"Javascript" por Tiago Rodrigues
"Javascript" por Tiago Rodrigues
 
Out with Regex, In with Tokens
Out with Regex, In with TokensOut with Regex, In with Tokens
Out with Regex, In with Tokens
 
Couch Db.0.9.0.Pub
Couch Db.0.9.0.PubCouch Db.0.9.0.Pub
Couch Db.0.9.0.Pub
 
Pascarello_Investigating JavaScript and Ajax Security
Pascarello_Investigating JavaScript and Ajax SecurityPascarello_Investigating JavaScript and Ajax Security
Pascarello_Investigating JavaScript and Ajax Security
 
Integrating Flex And Rails With Ruby Amf
Integrating Flex And Rails With Ruby AmfIntegrating Flex And Rails With Ruby Amf
Integrating Flex And Rails With Ruby Amf
 

Recently uploaded

08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 

Recently uploaded (20)

08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 

Manage Data and Filter Records with TaffyDB

  • 1. Better Data Management with TaffyDB taffydb.com
  • 2. Who here considered themselves a JavaScript Programmer 5 years ago?
  • 3.
  • 4. Three Types of JavaScript Developer
  • 5. Three Types of JavaScript Developer
  • 6. Three Types of JavaScript Developer
  • 7. Three Types of JavaScript Developer
  • 8. Three Types of JavaScript Developer
  • 9. Three Types of JavaScript Developer
  • 10.
  • 11. It all started with arrays
  • 12. It all started with arrays var todos = [ [quot;Home To Dosquot;,1,false,[ [quot;Replace light bulbsquot;,false,quot;Ianquot;], [quot;Clean out deskquot;,false,quot;Ianquot;]] ], [quot;Work To Dosquot;,0,true,[ [quot;Fix bug with formquot;,false,quot;Ianquot;], [quot;Draft requirements docquot;,false,quot;Ianquot;], [quot;Learn JavaScript Objectsquot;,false,quot;Ianquot;]] ] ];
  • 13. It all started with arrays var todos = [ [quot;Home To Dosquot;,1,false,[ [quot;Replace light bulbsquot;,false,quot;Ianquot;], [quot;Clean out deskquot;,false,quot;Ianquot;]] ], [quot;Work To Dosquot;,0,true,[ [quot;Fix bug with formquot;,false,quot;Ianquot;], [quot;Draft requirements docquot;,false,quot;Ianquot;], [quot;Learn JavaScript Objectsquot;,false,quot;Ianquot;]] ] ]; // update Fix bug with form to complete todos[1][3][0][1] = true;
  • 14. Functions like this function checkTask (list,task) { for(var li = 0;li<todos;li++) { if (todos[li][0] == list) { for (var ta = 0; ta < todos[li][3]; ta++) { if (todos[li][3][ta][0] == task) { todos[li][3][ta][1] == true; } } } } } checkTask(quot;Work To Dosquot;,quot;Draft requirements docquot;);
  • 15.
  • 17. JavaScript Object Literals Useful for storing related name value pairs: {country:quot;United Statesquot;, government:quot;Democracyquot;, president:quot;Barrak Obamaquot;}
  • 18. JavaScript Object Literals Useful for storing related name value pairs: {country:quot;United Statesquot;, government:quot;Democracyquot;, president:quot;Barrak Obamaquot;} Also useful for composing instructions for functions: find({government:quot;Democracyquot;}) // find all records where government == Democracy
  • 20. This is TaffyDB • A wrapper for object literals (records)
  • 21. This is TaffyDB • A wrapper for object literals (records) • Provides a JavaScript centric API (using arrays/objects)
  • 22. This is TaffyDB • A wrapper for object literals (records) • Provides a JavaScript centric API (using arrays/objects) • Uses familiar database concepts
  • 23. This is TaffyDB • A wrapper for object literals (records) • Provides a JavaScript centric API (using arrays/objects) • Uses familiar database concepts • But it isn't a DB - no persistence
  • 24. This is TaffyDB • A wrapper for object literals (records) • Provides a JavaScript centric API (using arrays/objects) • Uses familiar database concepts • But it isn't a DB - no persistence • Thin (under 12K) • Opensource and Free • Maintained (v1.7.1) • One global object, no prototype modification
  • 25. Create a data collection // create a populated data collection var jsConfSpeakers = TAFFY([ {quot;namequot;:quot;John Resigquot;,quot;topicquot;:quot;Surprise!quot;}, {quot;namequot;:quot;Francisco Tolmaskquot;,quot;topicquot;:quot;Objective-Jquot;}, {quot;namequot;:quot;Chris Andersonquot;,quot;topicquot;:quot;CouchDBquot;}, {quot;namequot;:quot;Jeff Hayniequot;,quot;topicquot;:quot;Web Apps on the Desktopquot;}, {quot;namequot;:quot;Stoyan Stefanovquot;,quot;topicquot;:quot;Kick Ass Web Appsquot;} ]);
  • 26. Insert jsConfSpeakers.insert( {quot;namequot;:quot;Richard D. Worthquot;,quot;topicquot;:quot;jQuery UIquot;} );
  • 27. Getting records jsConfSpeakers.first(); // returns {quot;namequot;:quot;John Resigquot;,quot;topicquot;:quot;Surprise!quot;}
  • 28. Getting records jsConfSpeakers.first(); // returns {quot;namequot;:quot;John Resigquot;,quot;topicquot;:quot;Surprise!quot;} // TaffyDB filtering is overloaded // 0 and [0] will both return the first record jsConfSpeakers.get(0); jsConfSpeakers.get([0]); // returns [{quot;namequot;:quot;John Resigquot;,quot;topicquot;:quot;Surprise!quot;}]
  • 29. Remove // delete is a reserved word // use remove function instead jsConfSpeakers.remove(0);
  • 31. Advanced filtering // Use Object Literals to construct quot;where clausesquot; jsConfSpeakers.find({name:quot;Chris Andersonquot;}); // returns [2]
  • 32. Advanced filtering // Use Object Literals to construct quot;where clausesquot; jsConfSpeakers.find({name:quot;Chris Andersonquot;}); // returns [2] jsConfSpeakers.find({topic:{like:quot;Web Appsquot;}}); // returns [3,4]
  • 33. Advanced filtering // Use Object Literals to construct quot;where clausesquot; jsConfSpeakers.find({name:quot;Chris Andersonquot;}); // returns [2] jsConfSpeakers.find({topic:{like:quot;Web Appsquot;}}); // returns [3,4] jsConfSpeakers.find({ topic:{like:quot;Web Appsquot;}, name:{like:quot;Jeffquot;}}); // returns [3] // quot;where topic like Web Apps and name like Jeffquot;
  • 34. Let's see it in action...
  • 35. .forEach() in details collection.forEach( function (r,index) { //whatever logic here },[optional filter]);
  • 36. .forEach() in details collection.forEach( function (r,index) { //whatever logic here },[optional filter]); // modify r and return it to update the record collection.forEach( function (r,index) { r.field = quot;new valuequot;; return r; });
  • 38. TaffyDB is Batteries Included Events: • onUpdate, onInsert, onRemove
  • 39. TaffyDB is Batteries Included Events: • onUpdate, onInsert, onRemove JSON Support
  • 40. TaffyDB is Batteries Included Events: • onUpdate, onInsert, onRemove JSON Support typeOf() methods
  • 41. TaffyDB is Batteries Included Events: • onUpdate, onInsert, onRemove JSON Support typeOf() methods Object Methods • isSameObject, mergeObject, etc
  • 42. TaffyDB is Batteries Included Events: • onUpdate, onInsert, onRemove JSON Support typeOf() methods Object Methods • isSameObject, mergeObject, etc Utility Methods
  • 44.
  • 45.
  • 51. http://taffydb.com Learn - Download - Find Help Contribute Code