SlideShare a Scribd company logo
An introduction to U1Db David Planella @ Ubuntu Online Summit, June 2014
> U1Db basics
(c) 2013 Canonical
U1Db in a nutshell
> U1DB is a database API for synchronised databases of JSON documents
> Enables apps to store documents and sync them across devices
> Implementations are platform-specific, the API is platform-agnostic
> Simple to use
> Schemaless - more flexibility and faster development
> Intended for user-specific data
U1Db basics
(c) 2013 Canonical
U1Db is document-oriented
> In U1Db databases store JSON documents
> Documents don’t need a predefined list of fields
{ "key": "value" }
{ "firstname": "Jan", "surname": "Molby", "position": "midfield" }
{ "department": "Department of redundancy department",
"managers": [
{ "name": "Mary", "phone_number": "12345" },
{ "name": "Katherine" },
{ "name": "Rob", "phone_number": "54321" } ]
}
U1Db basics
(c) 2013 Canonical
U1Db elements
> Document storage and retrieval
> Covers the basic creation, retrieval and edition of documents
> Database, Document
> Querying
> Retrieval of a subset of documents based on certain criteria
> Index, Query
> Sync
> Synchronization of data across devices via a U1Db server
> Synchronizer
U1Db basics
> U1Db for app developers
(c) 2013 Canonical
Document storage and retrieval: the Database
> Provides the permanent storage for the app’s data
> Can be used directly as a model by other QML elements (e.g. ListView)
import U1db 1.0 as U1db
U1db.Database {
id: aDatabase
path: "aDatabase.u1db"
}
U1Db for app developers
(c) 2013 Canonical
Document storage and retrieval: the Document
> A database will generally contain multiple JSON-oriented documents
> Documents can be created dynamically at runtime
import U1db 1.0 as U1db
U1db.Document {
id: aDocument
database: aDatabase
docId: "lastPlace"
create: true
defaults: { "place": "Barcelona" }
}
U1Db for app developers
(c) 2013 Canonical
Querying: the Index
> An Index defines what fields can be filtered using a Query
> Used to retrieve documents other than by doc ID
> An index is created from ‘’index expressions’‘, which name one
or more fields in the document
import U1db 1.0 as U1db
U1db.Index {
id: by_place
database: aDatabase
expression: ["place"] // Use dot notation for nested fields
}
U1Db for app developers
(c) 2013 Canonical
Querying: the Query
> Once an index has been defined, the query is used to retrieve the data
> Can be used directly as a model by other QML elements (e.g. ListView)
> “Starts with” queries with wildcards are also supported
import U1db 1.0 as U1db
U1db.Query {
id: places
index: by_place
query: [ { "*" } ] // Could also be "Barc*" for further filtering
}
U1Db for app developers
> U1Db demo
Thank you
and
stay in touch!
> David Planella <david.planella@ubuntu.com>
> +DavidPlanella · @dplanella
> developer.ubuntu.com
> @ubuntuappdev
> gplus.to/ubuntuappdev
> facebook.com/ubuntuappdev

More Related Content

PPTX
Querying mongo db
PPT
Introduction to MongoDB
PPTX
PPTX
Mongo DB Presentation
PDF
MongoDB - An Introduction
PPTX
Mongo DB 102
PDF
FITC presents: Mobile & offline data synchronization in Angular JS
PPT
Introduction to MongoDB
Querying mongo db
Introduction to MongoDB
Mongo DB Presentation
MongoDB - An Introduction
Mongo DB 102
FITC presents: Mobile & offline data synchronization in Angular JS
Introduction to MongoDB

What's hot (20)

PDF
An introduction to MongoDB
PDF
Mongo db basics
PPTX
MongoDB 101
PPTX
Introduction to MongoDB
PDF
Updating materialized views and caches using kafka
PPT
2011 mongo FR - scaling with mongodb
PDF
Analytics with MongoDB Aggregation Framework and Hadoop Connector
PPTX
Introduction to MongoDB
PDF
Full metal mongo
PPTX
The Aggregation Framework
PPTX
MongoDB
PDF
Replicating application data into materialized views
PDF
Webinar: Working with Graph Data in MongoDB
PPT
2011 Mongo FR - MongoDB introduction
PPTX
MongoDB using Grails plugin by puneet behl
PDF
Mongo Presentation by Metatagg Solutions
PPTX
Agg framework selectgroup feb2015 v2
PDF
MongoDB Europe 2016 - Graph Operations with MongoDB
PDF
Rethinkdb
An introduction to MongoDB
Mongo db basics
MongoDB 101
Introduction to MongoDB
Updating materialized views and caches using kafka
2011 mongo FR - scaling with mongodb
Analytics with MongoDB Aggregation Framework and Hadoop Connector
Introduction to MongoDB
Full metal mongo
The Aggregation Framework
MongoDB
Replicating application data into materialized views
Webinar: Working with Graph Data in MongoDB
2011 Mongo FR - MongoDB introduction
MongoDB using Grails plugin by puneet behl
Mongo Presentation by Metatagg Solutions
Agg framework selectgroup feb2015 v2
MongoDB Europe 2016 - Graph Operations with MongoDB
Rethinkdb
Ad

Similar to An introduction to U1db (20)

PPTX
MongoDB
KEY
NOSQL101, Or: How I Learned To Stop Worrying And Love The Mongo!
PDF
Which Questions We Should Have
PPTX
Introducing Azure DocumentDB - NoSQL, No Problem
PPTX
Cool NoSQL on Azure with DocumentDB
PPTX
Schema design mongo_boston
PDF
3-Mongodb and Mapreduce Programming.pdf
PDF
Drupal Day 2011 - Drupal and the rise of the documents
PPTX
Mongo db
PPTX
Azure DocumentDB
PPTX
Schema Design
KEY
MongoDB - Ruby document store that doesn't rhyme with ouch
PDF
React-Native Lecture 11: In App Storage
PPTX
[PASS Summit 2016] Azure DocumentDB: A Deep Dive into Advanced Features
PPTX
Bi presentation
PPTX
Document databases
PDF
Schema & Design
PPTX
DotNetToscana: NoSQL Revolution - RavenDB
PDF
MongoDB is the MashupDB
PDF
OrientDB: Unlock the Value of Document Data Relationships
MongoDB
NOSQL101, Or: How I Learned To Stop Worrying And Love The Mongo!
Which Questions We Should Have
Introducing Azure DocumentDB - NoSQL, No Problem
Cool NoSQL on Azure with DocumentDB
Schema design mongo_boston
3-Mongodb and Mapreduce Programming.pdf
Drupal Day 2011 - Drupal and the rise of the documents
Mongo db
Azure DocumentDB
Schema Design
MongoDB - Ruby document store that doesn't rhyme with ouch
React-Native Lecture 11: In App Storage
[PASS Summit 2016] Azure DocumentDB: A Deep Dive into Advanced Features
Bi presentation
Document databases
Schema & Design
DotNetToscana: NoSQL Revolution - RavenDB
MongoDB is the MashupDB
OrientDB: Unlock the Value of Document Data Relationships
Ad

Recently uploaded (20)

PDF
Electronic commerce courselecture one. Pdf
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
Big Data Technologies - Introduction.pptx
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Machine learning based COVID-19 study performance prediction
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
cuic standard and advanced reporting.pdf
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PPTX
MYSQL Presentation for SQL database connectivity
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPT
Teaching material agriculture food technology
Electronic commerce courselecture one. Pdf
Diabetes mellitus diagnosis method based random forest with bat algorithm
NewMind AI Weekly Chronicles - August'25-Week II
Chapter 3 Spatial Domain Image Processing.pdf
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Programs and apps: productivity, graphics, security and other tools
The Rise and Fall of 3GPP – Time for a Sabbatical?
Big Data Technologies - Introduction.pptx
Advanced methodologies resolving dimensionality complications for autism neur...
Machine learning based COVID-19 study performance prediction
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
cuic standard and advanced reporting.pdf
Review of recent advances in non-invasive hemoglobin estimation
MIND Revenue Release Quarter 2 2025 Press Release
MYSQL Presentation for SQL database connectivity
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Building Integrated photovoltaic BIPV_UPV.pdf
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Teaching material agriculture food technology

An introduction to U1db

  • 1. An introduction to U1Db David Planella @ Ubuntu Online Summit, June 2014
  • 3. (c) 2013 Canonical U1Db in a nutshell > U1DB is a database API for synchronised databases of JSON documents > Enables apps to store documents and sync them across devices > Implementations are platform-specific, the API is platform-agnostic > Simple to use > Schemaless - more flexibility and faster development > Intended for user-specific data U1Db basics
  • 4. (c) 2013 Canonical U1Db is document-oriented > In U1Db databases store JSON documents > Documents don’t need a predefined list of fields { "key": "value" } { "firstname": "Jan", "surname": "Molby", "position": "midfield" } { "department": "Department of redundancy department", "managers": [ { "name": "Mary", "phone_number": "12345" }, { "name": "Katherine" }, { "name": "Rob", "phone_number": "54321" } ] } U1Db basics
  • 5. (c) 2013 Canonical U1Db elements > Document storage and retrieval > Covers the basic creation, retrieval and edition of documents > Database, Document > Querying > Retrieval of a subset of documents based on certain criteria > Index, Query > Sync > Synchronization of data across devices via a U1Db server > Synchronizer U1Db basics
  • 6. > U1Db for app developers
  • 7. (c) 2013 Canonical Document storage and retrieval: the Database > Provides the permanent storage for the app’s data > Can be used directly as a model by other QML elements (e.g. ListView) import U1db 1.0 as U1db U1db.Database { id: aDatabase path: "aDatabase.u1db" } U1Db for app developers
  • 8. (c) 2013 Canonical Document storage and retrieval: the Document > A database will generally contain multiple JSON-oriented documents > Documents can be created dynamically at runtime import U1db 1.0 as U1db U1db.Document { id: aDocument database: aDatabase docId: "lastPlace" create: true defaults: { "place": "Barcelona" } } U1Db for app developers
  • 9. (c) 2013 Canonical Querying: the Index > An Index defines what fields can be filtered using a Query > Used to retrieve documents other than by doc ID > An index is created from ‘’index expressions’‘, which name one or more fields in the document import U1db 1.0 as U1db U1db.Index { id: by_place database: aDatabase expression: ["place"] // Use dot notation for nested fields } U1Db for app developers
  • 10. (c) 2013 Canonical Querying: the Query > Once an index has been defined, the query is used to retrieve the data > Can be used directly as a model by other QML elements (e.g. ListView) > “Starts with” queries with wildcards are also supported import U1db 1.0 as U1db U1db.Query { id: places index: by_place query: [ { "*" } ] // Could also be "Barc*" for further filtering } U1Db for app developers
  • 12. Thank you and stay in touch! > David Planella <david.planella@ubuntu.com> > +DavidPlanella · @dplanella > developer.ubuntu.com > @ubuntuappdev > gplus.to/ubuntuappdev > facebook.com/ubuntuappdev