SlideShare une entreprise Scribd logo
1  sur  23
Télécharger pour lire hors ligne
Apache CouchDB
Myles Braithwaite
me@mylesb.ca | http://mylesb.ca | @mylesb
What is CouchDB?
Apache CouchDB is a database
that uses JSON for documents,
JavaScript for MapReduce
indexes, and regular HTTP for its
API.
Django may be built for the Web,
but CouchDB is built of the
Web.
— Jacob Kaplan-Moss, Django Developer
Document Based Key/Value Store
Unlike a relational database (i.e. Postgres & MySQL),
CouchDB doesn’t store it’s data and relationships in
tables. Instead, each database is a collection of
independent JSON documents.
Data Types
— "string": "abcdefghijklmnopqrstuvwxyz"
— "number": 123
— "float": 123.45
— "dict": {}
— "list": []
— "bool": true
{
"_id": "30b0ed91384411e4af34c42c03094720",
"_rev": "1-3573aeb5384411e4b121c42c03094720",
"name": {
"given_name": "Myles",
"family_name": "Braithwaite"
},
"emails": [
{
"type": "personal",
"email": "me@mylesb.ca"
},
{
"type": "work",
"email": "myles@monkeyinyoursoul.com"
}
]
}
HTTP Based API for Interacting with your Data
— Create = INSERT = PUT
— Retrieve = SELECT = GET
— Update = UPDATE = POST
— Delete = DELETE = DELETE
Examples
— Written in Python using the Kenneth Reitz's requests
library.
from myles_custom_urllib_parse import urljoin
from requests import get, post, put, delete, request
COUCHDB_URL = "http://127.0.0.1:5984/"
DB_NAME = "contacts"
r = requests.get(COUCHDB_URL)
print r.json()
{
"couchdb": "Welcome",
"uuid": "f9d2966e384711e499cfc42c03094720",
"vendor": {
"name": "The Apache Software Foundation",
"version": "1.4.0"
},
"version": "1.4.0"
}
Create a Database
r = put(urljoin(COUCHDB_URL, DB_NAME))
if not r.status_code == 201:
print ERROR_RESPONSE[r.status_code]
print r.json()
{"ok": true}
Create
data = {"name": {"first_name": "Myles", "last_name": "Braithwaite"}}
r = post(urljoin(COUCHDB_URL, DB_NAME), data)
if not r.status_code == 201:
print ERROR_RESPONSE[r.status_code]
print r.json()
{"ok": true, "id": "30b0ed91384411e4af34c42c03094720", "rev": "1-3573aeb5384411e4b121c42c03094720"}
Create (with a non-automatic ID)
data = {"name": {"first_name": "Myles", "last_name": "Braithwaite"}}
DOC_ID = "9999-myles-braithwaite"
r = put(urljoin(COUCHDB_URL, DB_NAME, DOC_ID), data)
if not r.status_code == 201:
print ERROR_RESPONSE[r.status_code]
print r.json()
{"ok": true, "id": "30b0ed91384411e4af34c42c03094720", "rev": "1-3573aeb5384411e4b121c42c03094720"}
Retrieve
DOC_ID = "30b0ed91384411e4af34c42c03094720"
r = get(urljoin(COUCHDB_URL, DB_NAME, DOC_ID))
if not r.ok:
print ERROR_RESPONSE[r.status_code]
r.json()
Update
DOC_ID = "30b0ed91384411e4af34c42c03094720"
r = get(urljoin(COUCHDB_URL, DB_NAME, DOC_ID))
data = r.json()
data['emails']: [
{
"type": "Personal", "email": "me@mylesb.ca",
"type": "Work", "email": "myles@miys.net"
}
]
r = post(urljoin(COUCHDB_URL, DB_NAME, DOC_ID), data)
if r.ok:
print ERROR_RESPONSE[r.status_code]
r.json()
{"ok": true, "id": "30b0ed91384411e4af34c42c03094720", "rev": "2-f57cf4d1384a11e4a3edc42c03094720"}
Delete
DOC_ID = "myles-braithwaite"
r = delete(
urljoin(COUCHDB_URL, DB_NAME, DOC_ID) + "?rev=%s" % DOC_REV)
)
Attachment
curl -vX 
PUT $COUCHDB_URL/$DB_NAME/$DOC_ID/headshot.jpg?rev=$REV 
--data-binary @avatar.jpg -H "Content-Type: image/jpg"
Copy
r = request(
'COPY',
urljoin(COUCHDB_URL, DB_NAME, DOC_ID),
{'destination': 'new-document'}
)
Other Features
— Replication
— Document Revisions
— Futon (similar to PHPMyAdmin)
— Auth (Basic, Cookie, Database)
— JavaScript based Map/Reduce
PouchDB
JavaScript clone of CouchDB that
can run well within a web
browser.
var db = new PouchDB('contacts');
db.put({
_id: 'myles-braithwaite',
first_name: 'Myles',
last_name: 'Braithwaite'
})
db.replicate.to('http://127.0.0.1:5984/contacts/)
Questions

Contenu connexe

Tendances

Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDBAlex Bilbie
 
Mongo Presentation by Metatagg Solutions
Mongo Presentation by Metatagg SolutionsMongo Presentation by Metatagg Solutions
Mongo Presentation by Metatagg SolutionsMetatagg Solutions
 
2011 Mongo FR - MongoDB introduction
2011 Mongo FR - MongoDB introduction2011 Mongo FR - MongoDB introduction
2011 Mongo FR - MongoDB introductionantoinegirbal
 
Agg framework selectgroup feb2015 v2
Agg framework selectgroup feb2015 v2Agg framework selectgroup feb2015 v2
Agg framework selectgroup feb2015 v2MongoDB
 
The Aggregation Framework
The Aggregation FrameworkThe Aggregation Framework
The Aggregation FrameworkMongoDB
 
PhpstudyTokyo MongoDB PHP CakePHP
PhpstudyTokyo MongoDB PHP CakePHPPhpstudyTokyo MongoDB PHP CakePHP
PhpstudyTokyo MongoDB PHP CakePHPichikaway
 
Visualizing Web Data Query Results
Visualizing Web Data Query ResultsVisualizing Web Data Query Results
Visualizing Web Data Query ResultsAnja Jentzsch
 
Webinar: Exploring the Aggregation Framework
Webinar: Exploring the Aggregation FrameworkWebinar: Exploring the Aggregation Framework
Webinar: Exploring the Aggregation FrameworkMongoDB
 
Webinar: Working with Graph Data in MongoDB
Webinar: Working with Graph Data in MongoDBWebinar: Working with Graph Data in MongoDB
Webinar: Working with Graph Data in MongoDBMongoDB
 
MongoDB: How it Works
MongoDB: How it WorksMongoDB: How it Works
MongoDB: How it WorksMike Dirolf
 
An introduction to CouchDB
An introduction to CouchDBAn introduction to CouchDB
An introduction to CouchDBDavid Coallier
 
Back to Basics Webinar 1: Introduction to NoSQL
Back to Basics Webinar 1: Introduction to NoSQLBack to Basics Webinar 1: Introduction to NoSQL
Back to Basics Webinar 1: Introduction to NoSQLMongoDB
 
CouchDB on Android
CouchDB on AndroidCouchDB on Android
CouchDB on AndroidSven Haiges
 

Tendances (19)

Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
 
Querying mongo db
Querying mongo dbQuerying mongo db
Querying mongo db
 
Mongo Presentation by Metatagg Solutions
Mongo Presentation by Metatagg SolutionsMongo Presentation by Metatagg Solutions
Mongo Presentation by Metatagg Solutions
 
2011 Mongo FR - MongoDB introduction
2011 Mongo FR - MongoDB introduction2011 Mongo FR - MongoDB introduction
2011 Mongo FR - MongoDB introduction
 
MongoDB at GUL
MongoDB at GULMongoDB at GUL
MongoDB at GUL
 
Agg framework selectgroup feb2015 v2
Agg framework selectgroup feb2015 v2Agg framework selectgroup feb2015 v2
Agg framework selectgroup feb2015 v2
 
The Aggregation Framework
The Aggregation FrameworkThe Aggregation Framework
The Aggregation Framework
 
PhpstudyTokyo MongoDB PHP CakePHP
PhpstudyTokyo MongoDB PHP CakePHPPhpstudyTokyo MongoDB PHP CakePHP
PhpstudyTokyo MongoDB PHP CakePHP
 
Visualizing Web Data Query Results
Visualizing Web Data Query ResultsVisualizing Web Data Query Results
Visualizing Web Data Query Results
 
MongoDB 101
MongoDB 101MongoDB 101
MongoDB 101
 
Webinar: Exploring the Aggregation Framework
Webinar: Exploring the Aggregation FrameworkWebinar: Exploring the Aggregation Framework
Webinar: Exploring the Aggregation Framework
 
Webinar: Working with Graph Data in MongoDB
Webinar: Working with Graph Data in MongoDBWebinar: Working with Graph Data in MongoDB
Webinar: Working with Graph Data in MongoDB
 
MongoDB
MongoDBMongoDB
MongoDB
 
MongoDB: How it Works
MongoDB: How it WorksMongoDB: How it Works
MongoDB: How it Works
 
MongoDB - Ekino PHP
MongoDB - Ekino PHPMongoDB - Ekino PHP
MongoDB - Ekino PHP
 
An introduction to CouchDB
An introduction to CouchDBAn introduction to CouchDB
An introduction to CouchDB
 
Back to Basics Webinar 1: Introduction to NoSQL
Back to Basics Webinar 1: Introduction to NoSQLBack to Basics Webinar 1: Introduction to NoSQL
Back to Basics Webinar 1: Introduction to NoSQL
 
CouchDB on Android
CouchDB on AndroidCouchDB on Android
CouchDB on Android
 
Mongo-Drupal
Mongo-DrupalMongo-Drupal
Mongo-Drupal
 

Similaire à Apache CouchDB Presentation @ Sept. 2104 GTALUG Meeting

OSCON 2011 CouchApps
OSCON 2011 CouchAppsOSCON 2011 CouchApps
OSCON 2011 CouchAppsBradley Holt
 
Apache CouchDB talk at Ontario GNU Linux Fest
Apache CouchDB talk at Ontario GNU Linux FestApache CouchDB talk at Ontario GNU Linux Fest
Apache CouchDB talk at Ontario GNU Linux FestMyles Braithwaite
 
Embedding a language into string interpolator
Embedding a language into string interpolatorEmbedding a language into string interpolator
Embedding a language into string interpolatorMichael Limansky
 
NoSQL meets Microservices - Michael Hackstein
NoSQL meets Microservices - Michael HacksteinNoSQL meets Microservices - Michael Hackstein
NoSQL meets Microservices - Michael Hacksteindistributed matters
 
Michael Hackstein - NoSQL meets Microservices - NoSQL matters Dublin 2015
Michael Hackstein - NoSQL meets Microservices - NoSQL matters Dublin 2015Michael Hackstein - NoSQL meets Microservices - NoSQL matters Dublin 2015
Michael Hackstein - NoSQL meets Microservices - NoSQL matters Dublin 2015NoSQLmatters
 
Webinar: General Technical Overview of MongoDB for Dev Teams
Webinar: General Technical Overview of MongoDB for Dev TeamsWebinar: General Technical Overview of MongoDB for Dev Teams
Webinar: General Technical Overview of MongoDB for Dev TeamsMongoDB
 
Introduction to MongoDB and Workshop
Introduction to MongoDB and WorkshopIntroduction to MongoDB and Workshop
Introduction to MongoDB and WorkshopAhmedabadJavaMeetup
 
MongoDB全機能解説2
MongoDB全機能解説2MongoDB全機能解説2
MongoDB全機能解説2Takahiro Inoue
 
Joins and Other MongoDB 3.2 Aggregation Enhancements
Joins and Other MongoDB 3.2 Aggregation EnhancementsJoins and Other MongoDB 3.2 Aggregation Enhancements
Joins and Other MongoDB 3.2 Aggregation EnhancementsAndrew Morgan
 
Couchdb: No SQL? No driver? No problem
Couchdb: No SQL? No driver? No problemCouchdb: No SQL? No driver? No problem
Couchdb: No SQL? No driver? No problemdelagoya
 
Spray Json and MongoDB Queries: Insights and Simple Tricks.
Spray Json and MongoDB Queries: Insights and Simple Tricks.Spray Json and MongoDB Queries: Insights and Simple Tricks.
Spray Json and MongoDB Queries: Insights and Simple Tricks.Andrii Lashchenko
 
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
 
jQuery Datatables With MongDb
jQuery Datatables With MongDbjQuery Datatables With MongDb
jQuery Datatables With MongDbsliimohara
 
NoSQL meets Microservices - Michael Hackstein
NoSQL meets Microservices -  Michael HacksteinNoSQL meets Microservices -  Michael Hackstein
NoSQL meets Microservices - Michael Hacksteindistributed matters
 
Introduction tomongodb
Introduction tomongodbIntroduction tomongodb
Introduction tomongodbLee Theobald
 

Similaire à Apache CouchDB Presentation @ Sept. 2104 GTALUG Meeting (20)

OSCON 2011 CouchApps
OSCON 2011 CouchAppsOSCON 2011 CouchApps
OSCON 2011 CouchApps
 
Apache CouchDB talk at Ontario GNU Linux Fest
Apache CouchDB talk at Ontario GNU Linux FestApache CouchDB talk at Ontario GNU Linux Fest
Apache CouchDB talk at Ontario GNU Linux Fest
 
Embedding a language into string interpolator
Embedding a language into string interpolatorEmbedding a language into string interpolator
Embedding a language into string interpolator
 
NoSQL meets Microservices - Michael Hackstein
NoSQL meets Microservices - Michael HacksteinNoSQL meets Microservices - Michael Hackstein
NoSQL meets Microservices - Michael Hackstein
 
NoSQL meets Microservices
NoSQL meets MicroservicesNoSQL meets Microservices
NoSQL meets Microservices
 
Michael Hackstein - NoSQL meets Microservices - NoSQL matters Dublin 2015
Michael Hackstein - NoSQL meets Microservices - NoSQL matters Dublin 2015Michael Hackstein - NoSQL meets Microservices - NoSQL matters Dublin 2015
Michael Hackstein - NoSQL meets Microservices - NoSQL matters Dublin 2015
 
Webinar: General Technical Overview of MongoDB for Dev Teams
Webinar: General Technical Overview of MongoDB for Dev TeamsWebinar: General Technical Overview of MongoDB for Dev Teams
Webinar: General Technical Overview of MongoDB for Dev Teams
 
Introduction to MongoDB and Workshop
Introduction to MongoDB and WorkshopIntroduction to MongoDB and Workshop
Introduction to MongoDB and Workshop
 
MongoDB and RDBMS
MongoDB and RDBMSMongoDB and RDBMS
MongoDB and RDBMS
 
MongoDB全機能解説2
MongoDB全機能解説2MongoDB全機能解説2
MongoDB全機能解説2
 
MongoDB
MongoDB MongoDB
MongoDB
 
Joins and Other MongoDB 3.2 Aggregation Enhancements
Joins and Other MongoDB 3.2 Aggregation EnhancementsJoins and Other MongoDB 3.2 Aggregation Enhancements
Joins and Other MongoDB 3.2 Aggregation Enhancements
 
Couchdb: No SQL? No driver? No problem
Couchdb: No SQL? No driver? No problemCouchdb: No SQL? No driver? No problem
Couchdb: No SQL? No driver? No problem
 
Spray Json and MongoDB Queries: Insights and Simple Tricks.
Spray Json and MongoDB Queries: Insights and Simple Tricks.Spray Json and MongoDB Queries: Insights and Simple Tricks.
Spray Json and MongoDB Queries: Insights and Simple Tricks.
 
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
 
Mongo db presentation
Mongo db presentationMongo db presentation
Mongo db presentation
 
Introduction to JSON & AJAX
Introduction to JSON & AJAXIntroduction to JSON & AJAX
Introduction to JSON & AJAX
 
jQuery Datatables With MongDb
jQuery Datatables With MongDbjQuery Datatables With MongDb
jQuery Datatables With MongDb
 
NoSQL meets Microservices - Michael Hackstein
NoSQL meets Microservices -  Michael HacksteinNoSQL meets Microservices -  Michael Hackstein
NoSQL meets Microservices - Michael Hackstein
 
Introduction tomongodb
Introduction tomongodbIntroduction tomongodb
Introduction tomongodb
 

Plus de Myles Braithwaite

LessCSS Presentation @ April 2015 GTALUG Meeting
LessCSS Presentation @ April 2015 GTALUG MeetingLessCSS Presentation @ April 2015 GTALUG Meeting
LessCSS Presentation @ April 2015 GTALUG MeetingMyles Braithwaite
 
jrnl Presentation @ March 2015 GTALUG Meeting
jrnl Presentation @ March 2015 GTALUG Meetingjrnl Presentation @ March 2015 GTALUG Meeting
jrnl Presentation @ March 2015 GTALUG MeetingMyles Braithwaite
 
The Internet and Your Business
The Internet and Your BusinessThe Internet and Your Business
The Internet and Your BusinessMyles Braithwaite
 
GTALUG Short Talk On Mercurial
GTALUG Short Talk On MercurialGTALUG Short Talk On Mercurial
GTALUG Short Talk On MercurialMyles Braithwaite
 
So You Want A Personal Website?
So You Want A Personal Website?So You Want A Personal Website?
So You Want A Personal Website?Myles Braithwaite
 
GTALUG Presentation on CouchDB
GTALUG Presentation on CouchDBGTALUG Presentation on CouchDB
GTALUG Presentation on CouchDBMyles Braithwaite
 

Plus de Myles Braithwaite (10)

Take a Stroll in the Bazaar
Take a Stroll in the BazaarTake a Stroll in the Bazaar
Take a Stroll in the Bazaar
 
LessCSS Presentation @ April 2015 GTALUG Meeting
LessCSS Presentation @ April 2015 GTALUG MeetingLessCSS Presentation @ April 2015 GTALUG Meeting
LessCSS Presentation @ April 2015 GTALUG Meeting
 
jrnl Presentation @ March 2015 GTALUG Meeting
jrnl Presentation @ March 2015 GTALUG Meetingjrnl Presentation @ March 2015 GTALUG Meeting
jrnl Presentation @ March 2015 GTALUG Meeting
 
The Internet and Your Business
The Internet and Your BusinessThe Internet and Your Business
The Internet and Your Business
 
The Devil and HTML5
The Devil and HTML5The Devil and HTML5
The Devil and HTML5
 
GTALUG Short Talk On Mercurial
GTALUG Short Talk On MercurialGTALUG Short Talk On Mercurial
GTALUG Short Talk On Mercurial
 
So You Want A Personal Website?
So You Want A Personal Website?So You Want A Personal Website?
So You Want A Personal Website?
 
Google App Engine
Google App EngineGoogle App Engine
Google App Engine
 
Django GTALUG Presentation
Django GTALUG PresentationDjango GTALUG Presentation
Django GTALUG Presentation
 
GTALUG Presentation on CouchDB
GTALUG Presentation on CouchDBGTALUG Presentation on CouchDB
GTALUG Presentation on CouchDB
 

Dernier

Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
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
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
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
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
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
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 

Dernier (20)

Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
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
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
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...
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
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
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 

Apache CouchDB Presentation @ Sept. 2104 GTALUG Meeting

  • 1. Apache CouchDB Myles Braithwaite me@mylesb.ca | http://mylesb.ca | @mylesb
  • 3. Apache CouchDB is a database that uses JSON for documents, JavaScript for MapReduce indexes, and regular HTTP for its API.
  • 4. Django may be built for the Web, but CouchDB is built of the Web. — Jacob Kaplan-Moss, Django Developer
  • 5. Document Based Key/Value Store Unlike a relational database (i.e. Postgres & MySQL), CouchDB doesn’t store it’s data and relationships in tables. Instead, each database is a collection of independent JSON documents.
  • 6. Data Types — "string": "abcdefghijklmnopqrstuvwxyz" — "number": 123 — "float": 123.45 — "dict": {} — "list": [] — "bool": true
  • 7. { "_id": "30b0ed91384411e4af34c42c03094720", "_rev": "1-3573aeb5384411e4b121c42c03094720", "name": { "given_name": "Myles", "family_name": "Braithwaite" }, "emails": [ { "type": "personal", "email": "me@mylesb.ca" }, { "type": "work", "email": "myles@monkeyinyoursoul.com" } ] }
  • 8. HTTP Based API for Interacting with your Data — Create = INSERT = PUT — Retrieve = SELECT = GET — Update = UPDATE = POST — Delete = DELETE = DELETE
  • 9. Examples — Written in Python using the Kenneth Reitz's requests library. from myles_custom_urllib_parse import urljoin from requests import get, post, put, delete, request COUCHDB_URL = "http://127.0.0.1:5984/" DB_NAME = "contacts"
  • 10. r = requests.get(COUCHDB_URL) print r.json() { "couchdb": "Welcome", "uuid": "f9d2966e384711e499cfc42c03094720", "vendor": { "name": "The Apache Software Foundation", "version": "1.4.0" }, "version": "1.4.0" }
  • 11. Create a Database r = put(urljoin(COUCHDB_URL, DB_NAME)) if not r.status_code == 201: print ERROR_RESPONSE[r.status_code] print r.json() {"ok": true}
  • 12. Create data = {"name": {"first_name": "Myles", "last_name": "Braithwaite"}} r = post(urljoin(COUCHDB_URL, DB_NAME), data) if not r.status_code == 201: print ERROR_RESPONSE[r.status_code] print r.json() {"ok": true, "id": "30b0ed91384411e4af34c42c03094720", "rev": "1-3573aeb5384411e4b121c42c03094720"}
  • 13. Create (with a non-automatic ID) data = {"name": {"first_name": "Myles", "last_name": "Braithwaite"}} DOC_ID = "9999-myles-braithwaite" r = put(urljoin(COUCHDB_URL, DB_NAME, DOC_ID), data) if not r.status_code == 201: print ERROR_RESPONSE[r.status_code] print r.json() {"ok": true, "id": "30b0ed91384411e4af34c42c03094720", "rev": "1-3573aeb5384411e4b121c42c03094720"}
  • 14. Retrieve DOC_ID = "30b0ed91384411e4af34c42c03094720" r = get(urljoin(COUCHDB_URL, DB_NAME, DOC_ID)) if not r.ok: print ERROR_RESPONSE[r.status_code] r.json()
  • 15. Update DOC_ID = "30b0ed91384411e4af34c42c03094720" r = get(urljoin(COUCHDB_URL, DB_NAME, DOC_ID)) data = r.json() data['emails']: [ { "type": "Personal", "email": "me@mylesb.ca", "type": "Work", "email": "myles@miys.net" } ] r = post(urljoin(COUCHDB_URL, DB_NAME, DOC_ID), data) if r.ok: print ERROR_RESPONSE[r.status_code] r.json() {"ok": true, "id": "30b0ed91384411e4af34c42c03094720", "rev": "2-f57cf4d1384a11e4a3edc42c03094720"}
  • 16. Delete DOC_ID = "myles-braithwaite" r = delete( urljoin(COUCHDB_URL, DB_NAME, DOC_ID) + "?rev=%s" % DOC_REV) )
  • 17. Attachment curl -vX PUT $COUCHDB_URL/$DB_NAME/$DOC_ID/headshot.jpg?rev=$REV --data-binary @avatar.jpg -H "Content-Type: image/jpg"
  • 18. Copy r = request( 'COPY', urljoin(COUCHDB_URL, DB_NAME, DOC_ID), {'destination': 'new-document'} )
  • 19. Other Features — Replication — Document Revisions — Futon (similar to PHPMyAdmin) — Auth (Basic, Cookie, Database) — JavaScript based Map/Reduce
  • 21. JavaScript clone of CouchDB that can run well within a web browser.
  • 22. var db = new PouchDB('contacts'); db.put({ _id: 'myles-braithwaite', first_name: 'Myles', last_name: 'Braithwaite' }) db.replicate.to('http://127.0.0.1:5984/contacts/)