full stack development with node.js and nosql by nic raboy
TRANSCRIPT
Full Stack Development with Node.js and NoSQL
Nic Raboy (@nraboy)
©2015 Couchbase Inc. 2
The Role of a Full Stack Developer
©2015 Couchbase Inc. 3
Application Stacks
©2015 Couchbase Inc. 4
The Power of the Flexible JSON Schema
• Ability to store data in multiple ways
• De-normalized single document, as opposed to normalizing data across multiple table
• Dynamic Schema to add new values when needed
©2015 Couchbase Inc. 5
What is Couchbase?
Couchbase is a distributed operational database that enables you to develop with agility and operate at any scale.
Managed Cache Key-Value Store Document Database Embedded Database Sync Management
©2015 Couchbase Inc. 6
Develop with Agility
Easier, Faster Development Flexible Data Modeling Powerful Querying
SQL Integration & Migration Big Data Integration Mobile / IoT
©2015 Couchbase Inc. 7
Operate at Any Scale
Elastic Scalability Consistent High Performance Always-on Availability
Multi-Data Center Deployment Simple, Powerful Administration Enterprise Grade Security
©2015 Couchbase Inc. 8
Couchbase Developer
©2015 Couchbase Inc. 9
Couchbase Server – Single Node Type
▪ Data Service – builds and maintains local view indexes
▪ Indexing Engine – builds and maintains Global Secondary Indexes
▪ Query Engine – plans, coordinates, and executes queries against either Global or Local view indexes
▪ Cluster Manager – configuration, heartbeat, statistics, RESTful Management interface
©2015 Couchbase Inc. 10
Simplified Administration
• Online upgrades and operations• Built-in enterprise class Admin Console• RESTful APIs
©2015 Couchbase Inc. 11
Accessing Data From Couchbase
Key access using Document ID
• Operations are extremely fast with consistent low latency
• Reads and writes are evenly distributed across Data Service nodes
• Data is cached in built-in Managed Caching layer and stored in persistent storage layer
Queries using N1QL
• SQL-like : SELECT * FROM WHERE, LIKE, GROUP, etc.,
• JOINs
• Powerful Extensions (nest, unnest) for JSON to support nested and hierarchical data structures.
• Multiple access paths – Views and global secondary indexes
• ODBC/JDBC drivers available
Views using static queries
• Pre-computed complex Map-Reduce queries
• Incrementally updated to power analytics, reporting and dashboards
• Strong for complex custom aggregations
Demo Time!
©2015 Couchbase Inc. 13
Node.js Sample Applications
https://github.com/couchbaselabs/try-cb-nodejs
https://github.com/couchbaselabs/restful-angularjs-nodejs
©2015 Couchbase Inc. 14
Couchbase N1QL Tutorial
http://query.pub.couchbase.com/tutorial/
©2015 Couchbase Inc. 15
Ottoman ODM
©2015 Couchbase Inc. 16
Ottoman Model
var RecordModel = ottoman.model("Record", { firstname: {type: "string”}, lastname: {type: "string"}, email: {type: "string"}, created_at: {type: “Date”, default: Date.now}});
©2015 Couchbase Inc. 17
Ottoman Saving
var myRecord = new RecordModel({ firstname: “Nic”, lastname: “Raboy”, email: “[email protected]”});
myRecord.save(function(error) { if(error) { // Error here } // Success here});
©2015 Couchbase Inc. 18
Ottoman Finding
RecordModel.find({}, function(error, result) { if(error) { // Error here } // Array of results here});
©2015 Couchbase Inc. 19
Where do you find us?
• developer.couchbase.com• blog.couchbase.com• @couchbasedev or @couchbase• forums.couchbase.com• stackoverflow.com/questions/tagged/couchbase