SlideShare a Scribd company logo
1 of 16
LokiJS
Javascript In-Memory Database
@tech_fort
??? WHAT ???
WHY?
● In-memory is faster than I/O
● SQLite is great but there is no NoSQL / document-oriented equivalent of it
● SQLite is cumbersome in a mobile / embedded context (who can be bothered
with SQL in a mobile app?)
● Phonegap and Node-Webkit apps would benefit from a javascript database where
data is plain javascript objects, and persisted on disk as JSON.
● Traditional databases rely on platform libraries which impose portability contraints
and version conflicts. Data is frequently 'locked-in'
● For many applications NoSql is a far more preferable and better performing
approach than relational data when working with complex object stores which are
built for consumption.
Enter Loki
●
LokiJS is compatible with browser and node.js
●
Persistence to disk on inserts/updates/deletes (in node.js, node-webkit and cordova
environments)
●
Available on bower and npm
●
Extremely low footprint - 28KB uncompressed!!
●
Supports indexing, and uses Binary Search for search granting fast performance
●
NoSQL jargon: documents, collections, map, reduce
●
Compatibility: dependency free, native, pure javascript runs across many js environments
●
Portablility : entire database state can be serialized as a single entity to be restored in an
identical state or transferred across environments as a single JSON entity.
●
Performs better than similar products (NeDB, TaffyDB, PouchDB etc.), and it's much smaller
Sample Usage
var loki = require('lokijs'),
  db = new loki('demo.json'),
  doctors;
doctors = db.addCollection('doctors', { indices: 
['name']});
doctors.insert({ name: 'David Tennant', doctor: 
10});
doctors.insert({ name: 'Matt Smith', doctor: 11});
doctors.insert({ name: 'Peter Capaldi', doctor: 
12});
Updates
● Updates are optional. LokiJS holds references
to objects so there's no need to update an
object. However, update(obj) can be called to
force re-indexing of collections.
Querying
● Querying is quite intuitive:
doctors.get(index);
doctors.find({ doctors: 10}); 
doctors.find({ doctors: { '$gte' : 
9}});
Querying (Mongo Style)
Mongo style queries will benefit from access to
index optimizations.
● Declarative query definition via a query object
● Current supported operators include $eq, $gt,
$gte, $lt, $lte, $ne, $regex, $in, $contains
● Supports dot notation for deep querying
Querying (Javascript views)
● Means of specifying complex 'edge case' query filters
● Write your own javascript filter function which can be
anonymous or persisted with a name as a view.
● Has access to the entire (possibly hierarchical) document
object
● Used for chained queries and dynamic views
● Worse performance / cant be serialized (need to be
reattach to dynview on load)
Fluent API
You can resort to functions to obtain your data by
leveraging the built-in ResultSet class:
doctors.chain()
  .find({ doctor: { '$gte': 9 }})
  .where(function (obj) { return 
obj.name.indexOf(“t”) != ­1; })
  .simplesort(“name”)
  .data(); // this exposes the data
Dynamic Views
Views hold references to filtered data to optmize search even further
(avoiding to scan the entire collection).
Thet maintain freshness of query results optimally as they are notified of
data inserts, updates and deletes.
var view = doctors.addDynamicView(“latestDoctors”);
view.applyFind({ doctor: { '$gte': 8}});
view.applySort(function (a, b) {
  return a.doctor < b.doctor;
});
// inspect the data
console.log(view.data());
Persistence
● Loki now supports three primary persistence methods : filesystem
(Node), localStorage (cordova/browser), and indexedDB
(cordova/browser)
● A new persistence adapter interface allows for interoperability with
other popular and/or custom data stores. Community members can
develop and submit adapters for popular datastores and submit a pull
request to share them.
● Autosave/Autoload capabilities exist for you to optionally utilize for
automating and bootstrapping persistence.
IndexedDB Support for browsers
● Loki now implements an indexedDB App/Key/Value Catalog,
implemented using the new persistence adapter interface.
● This catalog can contain as many databases as your storage
quota allows, organized by application. This allows grouping,
listing and querying the catalog of databases by 'application'
groups.
● Loki's indexedDB adapter supports console use for easily
managing your catalog from a browser console.
Summary
● Use collection operations (insert, update, delete)
for document-oriented maintenance
● Use collection operations (find, where) for optimal
query performance
● Use resultset with fluent-like syntax for defining
complex query-oriented pipelines
● Use dynamic view for defining views which inherit
the resultset pipeline, yet avoid needing to requery
RoadMap
● MRU cache / Key-value store option
● TCP and HTTP Wrappers to enable running
LokiJS on dedicated (virtual) machines
● Replication
● Horizontal scaling
● MongoDB API subset compatibility
Links:
Web: http://lokijs.org
Github: https://github.com/techfort/LokiJS
Contributors:
Joe Minichino
Dave Easterday
@tech_fort

More Related Content

What's hot

TMDC Vidrio Presentation
TMDC Vidrio PresentationTMDC Vidrio Presentation
TMDC Vidrio PresentationRicardo Vidrio
 
Invisible excitations in hexagonal Boron Nitride
Invisible excitations  in hexagonal Boron NitrideInvisible excitations  in hexagonal Boron Nitride
Invisible excitations in hexagonal Boron NitrideClaudio Attaccalite
 
Band structure and surface properties of 1-4 layers of MoS2
Band structure and surface properties of 1-4 layers of MoS2Band structure and surface properties of 1-4 layers of MoS2
Band structure and surface properties of 1-4 layers of MoS2Po-Chun Yeh
 
Gw renormalization of the electron phonon coupling
Gw renormalization of the electron phonon couplingGw renormalization of the electron phonon coupling
Gw renormalization of the electron phonon couplingClaudio Attaccalite
 
Solid state physics unit 1.pdf
Solid state physics unit 1.pdfSolid state physics unit 1.pdf
Solid state physics unit 1.pdfshadreckalmando
 
Nanophotocatalyst in organic transformation
Nanophotocatalyst in organic transformationNanophotocatalyst in organic transformation
Nanophotocatalyst in organic transformationAshwani Dalal
 
seawater desalination using MoS2 nanopore POWER POINT
seawater desalination using MoS2 nanopore POWER POINTseawater desalination using MoS2 nanopore POWER POINT
seawater desalination using MoS2 nanopore POWER POINTprincely oriomojor
 
Buku siswa ipa smt 2
Buku siswa ipa smt 2Buku siswa ipa smt 2
Buku siswa ipa smt 2Ritma Ariesha
 
Poradnik jak zlozyc_dobry_wniosek_do_ncn
Poradnik jak  zlozyc_dobry_wniosek_do_ncnPoradnik jak  zlozyc_dobry_wniosek_do_ncn
Poradnik jak zlozyc_dobry_wniosek_do_ncngranty-na-badania
 
Burris AR-332 Instruction Manual | Optics Trade
Burris AR-332 Instruction Manual | Optics TradeBurris AR-332 Instruction Manual | Optics Trade
Burris AR-332 Instruction Manual | Optics TradeOptics-Trade
 
magnesium doped zinc oxide nano particle
magnesium doped zinc oxide nano particlemagnesium doped zinc oxide nano particle
magnesium doped zinc oxide nano particleabhi3607
 
9 pengenalan-bangun-ruang-dan-sifat2nya
9 pengenalan-bangun-ruang-dan-sifat2nya9 pengenalan-bangun-ruang-dan-sifat2nya
9 pengenalan-bangun-ruang-dan-sifat2nyaNophita Pyota
 
Amorphous Materials: Structural Principles and Characterization
Amorphous Materials: Structural Principles and CharacterizationAmorphous Materials: Structural Principles and Characterization
Amorphous Materials: Structural Principles and CharacterizationUniversity of Wisconsin MRSEC
 
Characterization of CVD grown molybdenum disulfide monolayer and exfoliated M...
Characterization of CVD grown molybdenum disulfide monolayer and exfoliated M...Characterization of CVD grown molybdenum disulfide monolayer and exfoliated M...
Characterization of CVD grown molybdenum disulfide monolayer and exfoliated M...Yan Yan
 
Crystalography
CrystalographyCrystalography
Crystalographymd5358dm
 
Bismuth Ferrite Nano particles
Bismuth Ferrite Nano particlesBismuth Ferrite Nano particles
Bismuth Ferrite Nano particlesAshish Goel
 

What's hot (20)

TMDC Vidrio Presentation
TMDC Vidrio PresentationTMDC Vidrio Presentation
TMDC Vidrio Presentation
 
Invisible excitations in hexagonal Boron Nitride
Invisible excitations  in hexagonal Boron NitrideInvisible excitations  in hexagonal Boron Nitride
Invisible excitations in hexagonal Boron Nitride
 
Band structure and surface properties of 1-4 layers of MoS2
Band structure and surface properties of 1-4 layers of MoS2Band structure and surface properties of 1-4 layers of MoS2
Band structure and surface properties of 1-4 layers of MoS2
 
Mte 583 class 18b
Mte 583 class 18bMte 583 class 18b
Mte 583 class 18b
 
Gw renormalization of the electron phonon coupling
Gw renormalization of the electron phonon couplingGw renormalization of the electron phonon coupling
Gw renormalization of the electron phonon coupling
 
Solid state physics unit 1.pdf
Solid state physics unit 1.pdfSolid state physics unit 1.pdf
Solid state physics unit 1.pdf
 
Nanophotocatalyst in organic transformation
Nanophotocatalyst in organic transformationNanophotocatalyst in organic transformation
Nanophotocatalyst in organic transformation
 
seawater desalination using MoS2 nanopore POWER POINT
seawater desalination using MoS2 nanopore POWER POINTseawater desalination using MoS2 nanopore POWER POINT
seawater desalination using MoS2 nanopore POWER POINT
 
Buku siswa ipa smt 2
Buku siswa ipa smt 2Buku siswa ipa smt 2
Buku siswa ipa smt 2
 
Poradnik jak zlozyc_dobry_wniosek_do_ncn
Poradnik jak  zlozyc_dobry_wniosek_do_ncnPoradnik jak  zlozyc_dobry_wniosek_do_ncn
Poradnik jak zlozyc_dobry_wniosek_do_ncn
 
Ising model
Ising modelIsing model
Ising model
 
Burris AR-332 Instruction Manual | Optics Trade
Burris AR-332 Instruction Manual | Optics TradeBurris AR-332 Instruction Manual | Optics Trade
Burris AR-332 Instruction Manual | Optics Trade
 
Rietveld Refinements ppt
Rietveld Refinements pptRietveld Refinements ppt
Rietveld Refinements ppt
 
magnesium doped zinc oxide nano particle
magnesium doped zinc oxide nano particlemagnesium doped zinc oxide nano particle
magnesium doped zinc oxide nano particle
 
UCSD NANO106 - 04 - Symmetry in Crystallography
UCSD NANO106 - 04 - Symmetry in CrystallographyUCSD NANO106 - 04 - Symmetry in Crystallography
UCSD NANO106 - 04 - Symmetry in Crystallography
 
9 pengenalan-bangun-ruang-dan-sifat2nya
9 pengenalan-bangun-ruang-dan-sifat2nya9 pengenalan-bangun-ruang-dan-sifat2nya
9 pengenalan-bangun-ruang-dan-sifat2nya
 
Amorphous Materials: Structural Principles and Characterization
Amorphous Materials: Structural Principles and CharacterizationAmorphous Materials: Structural Principles and Characterization
Amorphous Materials: Structural Principles and Characterization
 
Characterization of CVD grown molybdenum disulfide monolayer and exfoliated M...
Characterization of CVD grown molybdenum disulfide monolayer and exfoliated M...Characterization of CVD grown molybdenum disulfide monolayer and exfoliated M...
Characterization of CVD grown molybdenum disulfide monolayer and exfoliated M...
 
Crystalography
CrystalographyCrystalography
Crystalography
 
Bismuth Ferrite Nano particles
Bismuth Ferrite Nano particlesBismuth Ferrite Nano particles
Bismuth Ferrite Nano particles
 

Similar to Lokijs

Polyglot Database - Linuxcon North America 2016
Polyglot Database - Linuxcon North America 2016Polyglot Database - Linuxcon North America 2016
Polyglot Database - Linuxcon North America 2016Dave Stokes
 
Introduction to NoSQL
Introduction to NoSQLIntroduction to NoSQL
Introduction to NoSQLbalwinders
 
Elasticsearch vs MongoDB comparison
Elasticsearch vs MongoDB comparisonElasticsearch vs MongoDB comparison
Elasticsearch vs MongoDB comparisonjeetendra mandal
 
Couchbase - Introduction
Couchbase - IntroductionCouchbase - Introduction
Couchbase - IntroductionKnoldus Inc.
 
ArangoDB – A different approach to NoSQL
ArangoDB – A different approach to NoSQLArangoDB – A different approach to NoSQL
ArangoDB – A different approach to NoSQLArangoDB Database
 
Analysis on NoSQL: MongoDB Tool
Analysis on NoSQL: MongoDB ToolAnalysis on NoSQL: MongoDB Tool
Analysis on NoSQL: MongoDB Toolijtsrd
 
Mongo Bb - NoSQL tutorial
Mongo Bb - NoSQL tutorialMongo Bb - NoSQL tutorial
Mongo Bb - NoSQL tutorialMohan Rathour
 
NoSQL Endgame LWJUG 2021
NoSQL Endgame LWJUG 2021NoSQL Endgame LWJUG 2021
NoSQL Endgame LWJUG 2021Thodoris Bais
 
MongoDB Lab Manual (1).pdf used in data science
MongoDB Lab Manual (1).pdf used in data scienceMongoDB Lab Manual (1).pdf used in data science
MongoDB Lab Manual (1).pdf used in data sciencebitragowthamkumar1
 
Couchbase - Yet Another Introduction
Couchbase - Yet Another IntroductionCouchbase - Yet Another Introduction
Couchbase - Yet Another IntroductionKelum Senanayake
 
SQL vs MongoDB
SQL vs MongoDBSQL vs MongoDB
SQL vs MongoDBcalltutors
 
SQL vs NoSQL, an experiment with MongoDB
SQL vs NoSQL, an experiment with MongoDBSQL vs NoSQL, an experiment with MongoDB
SQL vs NoSQL, an experiment with MongoDBMarco Segato
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.jsWinston Hsieh
 
A Presentation on MongoDB Introduction - Habilelabs
A Presentation on MongoDB Introduction - HabilelabsA Presentation on MongoDB Introduction - Habilelabs
A Presentation on MongoDB Introduction - HabilelabsHabilelabs
 

Similar to Lokijs (20)

Polyglot Database - Linuxcon North America 2016
Polyglot Database - Linuxcon North America 2016Polyglot Database - Linuxcon North America 2016
Polyglot Database - Linuxcon North America 2016
 
Introduction to NoSQL
Introduction to NoSQLIntroduction to NoSQL
Introduction to NoSQL
 
CSCi226PPT1
CSCi226PPT1CSCi226PPT1
CSCi226PPT1
 
Elasticsearch vs MongoDB comparison
Elasticsearch vs MongoDB comparisonElasticsearch vs MongoDB comparison
Elasticsearch vs MongoDB comparison
 
NoSql Databases
NoSql DatabasesNoSql Databases
NoSql Databases
 
Unit 3 MongDB
Unit 3 MongDBUnit 3 MongDB
Unit 3 MongDB
 
Couchbase - Introduction
Couchbase - IntroductionCouchbase - Introduction
Couchbase - Introduction
 
ArangoDB – A different approach to NoSQL
ArangoDB – A different approach to NoSQLArangoDB – A different approach to NoSQL
ArangoDB – A different approach to NoSQL
 
Analysis on NoSQL: MongoDB Tool
Analysis on NoSQL: MongoDB ToolAnalysis on NoSQL: MongoDB Tool
Analysis on NoSQL: MongoDB Tool
 
Mongo Bb - NoSQL tutorial
Mongo Bb - NoSQL tutorialMongo Bb - NoSQL tutorial
Mongo Bb - NoSQL tutorial
 
NoSQL Endgame LWJUG 2021
NoSQL Endgame LWJUG 2021NoSQL Endgame LWJUG 2021
NoSQL Endgame LWJUG 2021
 
MongoDB Lab Manual (1).pdf used in data science
MongoDB Lab Manual (1).pdf used in data scienceMongoDB Lab Manual (1).pdf used in data science
MongoDB Lab Manual (1).pdf used in data science
 
Couchbase - Yet Another Introduction
Couchbase - Yet Another IntroductionCouchbase - Yet Another Introduction
Couchbase - Yet Another Introduction
 
Jooq java object oriented querying
Jooq java object oriented queryingJooq java object oriented querying
Jooq java object oriented querying
 
SQL vs MongoDB
SQL vs MongoDBSQL vs MongoDB
SQL vs MongoDB
 
No sq lv1_0
No sq lv1_0No sq lv1_0
No sq lv1_0
 
Oslo bekk2014
Oslo bekk2014Oslo bekk2014
Oslo bekk2014
 
SQL vs NoSQL, an experiment with MongoDB
SQL vs NoSQL, an experiment with MongoDBSQL vs NoSQL, an experiment with MongoDB
SQL vs NoSQL, an experiment with MongoDB
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
 
A Presentation on MongoDB Introduction - Habilelabs
A Presentation on MongoDB Introduction - HabilelabsA Presentation on MongoDB Introduction - Habilelabs
A Presentation on MongoDB Introduction - Habilelabs
 

Recently uploaded

call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park masabamasaba
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Hararemasabamasaba
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisamasabamasaba
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisamasabamasaba
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdfPearlKirahMaeRagusta1
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is insideshinachiaurasa2
 
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...Nitya salvi
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfproinshot.com
 
Generic or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisionsGeneric or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisionsBert Jan Schrijver
 
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...masabamasaba
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyviewmasabamasaba
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareJim McKeeth
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfkalichargn70th171
 

Recently uploaded (20)

call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
Generic or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisionsGeneric or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisions
 
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 

Lokijs

  • 3. WHY? ● In-memory is faster than I/O ● SQLite is great but there is no NoSQL / document-oriented equivalent of it ● SQLite is cumbersome in a mobile / embedded context (who can be bothered with SQL in a mobile app?) ● Phonegap and Node-Webkit apps would benefit from a javascript database where data is plain javascript objects, and persisted on disk as JSON. ● Traditional databases rely on platform libraries which impose portability contraints and version conflicts. Data is frequently 'locked-in' ● For many applications NoSql is a far more preferable and better performing approach than relational data when working with complex object stores which are built for consumption.
  • 4. Enter Loki ● LokiJS is compatible with browser and node.js ● Persistence to disk on inserts/updates/deletes (in node.js, node-webkit and cordova environments) ● Available on bower and npm ● Extremely low footprint - 28KB uncompressed!! ● Supports indexing, and uses Binary Search for search granting fast performance ● NoSQL jargon: documents, collections, map, reduce ● Compatibility: dependency free, native, pure javascript runs across many js environments ● Portablility : entire database state can be serialized as a single entity to be restored in an identical state or transferred across environments as a single JSON entity. ● Performs better than similar products (NeDB, TaffyDB, PouchDB etc.), and it's much smaller
  • 6. Updates ● Updates are optional. LokiJS holds references to objects so there's no need to update an object. However, update(obj) can be called to force re-indexing of collections.
  • 7. Querying ● Querying is quite intuitive: doctors.get(index); doctors.find({ doctors: 10});  doctors.find({ doctors: { '$gte' :  9}});
  • 8. Querying (Mongo Style) Mongo style queries will benefit from access to index optimizations. ● Declarative query definition via a query object ● Current supported operators include $eq, $gt, $gte, $lt, $lte, $ne, $regex, $in, $contains ● Supports dot notation for deep querying
  • 9. Querying (Javascript views) ● Means of specifying complex 'edge case' query filters ● Write your own javascript filter function which can be anonymous or persisted with a name as a view. ● Has access to the entire (possibly hierarchical) document object ● Used for chained queries and dynamic views ● Worse performance / cant be serialized (need to be reattach to dynview on load)
  • 10. Fluent API You can resort to functions to obtain your data by leveraging the built-in ResultSet class: doctors.chain()   .find({ doctor: { '$gte': 9 }})   .where(function (obj) { return  obj.name.indexOf(“t”) != ­1; })   .simplesort(“name”)   .data(); // this exposes the data
  • 11. Dynamic Views Views hold references to filtered data to optmize search even further (avoiding to scan the entire collection). Thet maintain freshness of query results optimally as they are notified of data inserts, updates and deletes. var view = doctors.addDynamicView(“latestDoctors”); view.applyFind({ doctor: { '$gte': 8}}); view.applySort(function (a, b) {   return a.doctor < b.doctor; }); // inspect the data console.log(view.data());
  • 12. Persistence ● Loki now supports three primary persistence methods : filesystem (Node), localStorage (cordova/browser), and indexedDB (cordova/browser) ● A new persistence adapter interface allows for interoperability with other popular and/or custom data stores. Community members can develop and submit adapters for popular datastores and submit a pull request to share them. ● Autosave/Autoload capabilities exist for you to optionally utilize for automating and bootstrapping persistence.
  • 13. IndexedDB Support for browsers ● Loki now implements an indexedDB App/Key/Value Catalog, implemented using the new persistence adapter interface. ● This catalog can contain as many databases as your storage quota allows, organized by application. This allows grouping, listing and querying the catalog of databases by 'application' groups. ● Loki's indexedDB adapter supports console use for easily managing your catalog from a browser console.
  • 14. Summary ● Use collection operations (insert, update, delete) for document-oriented maintenance ● Use collection operations (find, where) for optimal query performance ● Use resultset with fluent-like syntax for defining complex query-oriented pipelines ● Use dynamic view for defining views which inherit the resultset pipeline, yet avoid needing to requery
  • 15. RoadMap ● MRU cache / Key-value store option ● TCP and HTTP Wrappers to enable running LokiJS on dedicated (virtual) machines ● Replication ● Horizontal scaling ● MongoDB API subset compatibility