O slideshow foi denunciado.
Utilizamos seu perfil e dados de atividades no LinkedIn para personalizar e exibir anúncios mais relevantes. Altere suas preferências de anúncios quando desejar.

Data modeling in Couchbase Mobile 2.0 – Couchbase Connect New York 2017

159 visualizações

Publicada em

The cornerstone of any application is the data model, and mobile and IoT apps are no exception. A good data model can form the basis for an agile application, an adaptable functionality roadmap, and a great customer experience. A bad data model is often behind rigid, poorly performing applications and unhappy customers. In abstract, data modeling can be an interesting and wide-ranging topic. But data modeling discussions are most useful within the context of a real-world application.
In this session you’ll get hands on with the brand new Couchbase Mobile 2.0 and learn how to define models for a multi-user to-do list application. We will demonstrate how to implement the data model in classes using the new Couchbase Lite 2.0 API and will cover defining models, supported data types in models, models for subdocuments, attachments, relationships, and inheritance.

Publicada em: Software
  • Seja o primeiro a comentar

  • Seja a primeira pessoa a gostar disto

Data modeling in Couchbase Mobile 2.0 – Couchbase Connect New York 2017

  1. 1. ©2017 Couchbase Inc. Data Modeling in Couchbase Mobile 2.0 1
  2. 2. ©2017 Couchbase Inc. Agenda 2 Developing with Couchbase Mobile 2.0 Today 1:15 PMLenox Ballroom Mobile & IoT: Enable your existing Couchbase Deployment Today 3:15 PMLenox Ballroom N1QL queries and FTS in Couchbase Mobile 2.0 Today 4:00 PMLenox Ballroom
  3. 3. ©2017 Couchbase Inc.©2017 Couchbase Inc. 3 Design: Modeling and Security
  4. 4. ©2017 Couchbase Inc. Introduction • Data Modeling • Access Control 4
  5. 5. ©2017 Couchbase Inc.©2017 Couchbase Inc. 5 Data Modeling
  6. 6. ©2017 Couchbase Inc. Task List Application - Features • Users create task lists, share with other users • Owner and users add and modify tasks • Tasks may include images 6
  7. 7. ©2017 Couchbase Inc.©2017 Couchbase Inc. 7 Demo
  8. 8. ©2017 Couchbase Inc. Task List Application - Entities 8 Task List name owner users Task name complete Sync Gateway User username
  9. 9. ©2017 Couchbase Inc. Tables to JSON 9 Task List name owner users { "type": "task-list", "name": "Groceries", "owner": "user1", "users": ["user2", "user3"] } { "type": "task", "name": "Potatoes", "complete": false } Task name complete
  10. 10. ©2017 Couchbase Inc. Document IDs 10 Task List name owner users { "_id": "dk39-4kd9-1w9d", "type": "task-list", "name": "Groceries", "owner": "user1", "users": ["user2", "user3"] } { "_id": "de30-5d54-75b4", "type": "task", "name": "Potatoes", "complete": false } Task name complete
  11. 11. ©2017 Couchbase Inc.©2017 Couchbase Inc. 11 Demo
  12. 12. ©2017 Couchbase Inc. Entity Relationships • 1-to-many relationship between task-list and task • Many-to-many relationship between task-list and user 12 { "_id": "dk39-4kd9-1w9d", "type": "task-list", "name": "Groceries", "owner": "user1", "users": ["user2", "user3"] } { "_id": "de30-5d54-75b4", "type": "task", "name": "Potatoes", "complete": false, "task-list": "dk39-4kd9-1w9d" }
  13. 13. ©2017 Couchbase Inc. Task List Application – List Sharing • Share your list with other users 13
  14. 14. ©2017 Couchbase Inc. Iterate Design: Private List Members • Embedding list members in the list document has problems: • Document size • Document volatility • Privacy – only owners should see full set of list users 14 { "_id": "dk39-4kd9-1w9d", "type": "task-list", "name": "Groceries", "owner": "user1", "users": ["user2", "user3"] }
  15. 15. ©2017 Couchbase Inc. Task List Application – List Users 15 { "_id": "dk39-4kd9-1w9d", "type": "task-list", "name": "Groceries", "owner": "user1", "users": ["user2", "user3"] } Task List User username list id list owner { "_id": "fd23-f3fw-3s9e", "type": "task-list.user", "username": "user2", "taskList": { "id":"dk39-4kd9-1w9d", "owner":"user1" } } Task List name owner users Task List name owner
  16. 16. ©2017 Couchbase Inc.©2017 Couchbase Inc. 16 Demo
  17. 17. ©2017 Couchbase Inc. Task Images 17 { "_id": "de30-5d54-75b4", "type": "task", "name": "Potatoes", "complete": false, "task-list": "dk39-4kd9-1w9d", "_attachments": { "image": {...} } } Task name complete task-list image
  18. 18. ©2017 Couchbase Inc. Changed in 2.0 • _attachments property is not used in 2.0 18 { "_id": "de30-5d54-75b4", "type": "task", "name": "Potatoes", "complete": false, "task-list": "dk39-4kd9-1w9d", "_attachments": { "image": { "type": "image/png" } } } { "_id": "de30-5d54-75b4", "type": "task", "name": "Potatoes", "complete": false, "task-list": "dk39-4kd9-1w9d", "image": { "_cbltype": "blob", "type": "image/png" } }
  19. 19. ©2017 Couchbase Inc.©2017 Couchbase Inc. 19 Roles
  20. 20. ©2017 Couchbase Inc.©2017 Couchbase Inc. 20 Access Control
  21. 21. ©2017 Couchbase Inc. Sync Gateway 21
  22. 22. ©2017 Couchbase Inc. Sync Function 22
  23. 23. ©2017 Couchbase Inc. Routing 23
  24. 24. ©2017 Couchbase Inc. Access Grant 24
  25. 25. ©2017 Couchbase Inc.©2017 Couchbase Inc. 25 Demo
  26. 26. ©2017 Couchbase Inc. 26 James Nocentini Tech writer @ Couchbase jamesn@couchbase.com @jamiltz IMAGE GOES HERE
  27. 27. ©2017 Couchbase Inc.©2017 Couchbase Inc. ThankYou! 27

×