Slide 1

Slide 1 text

Mark Smith Intro to MongoDB + Mobile Mohit Sharma

Slide 2

Slide 2 text

This webinar will be recorded — the recording will be shared. Logistics All participants will be muted. For questions during & at the end of the session, please use the Q&A box. For live comments, please use the Chat in the control panel. There will be a short survey at the end - your input is appreciated :)

Slide 3

Slide 3 text

Agenda MongoDB: More Than Just a Database! MongoDB and the Document Model Querying MongoDB Let's Build a Mobile App! Q&A (fill in the survey!)

Slide 4

Slide 4 text

MongoDB: More than just a database!

Slide 5

Slide 5 text

A developer data platform to simplify working with data Elegant developer experience Serve any application or workload Modern data model Abstraction of infrastructure details

Slide 6

Slide 6 text

End-to-end, enterprise-grade security features Realm MongoDB Atlas Atlas Device Sync In-cloud security: Features that integrate with your existing protocols and compliance standards. ● Encrypted storage volumes ● Network isolation ● Role-based access management On-device encryption: Easily encrypt PII in realm database files with the encryption APIs Authorization: Rich authorization methods including anonymous, email/password, API key, Custom Function, Custom JWT, Facebook, Google, and Apple. In-flight encryption: All network traffic is encrypted using Transport layer Security (TLS). Granular permissions: Document and field-level access permissions are used to dynamically determine the data synced to the device. ISO SOC PCI CSA HIPAA HITRUST VPAT GDPR On-device In-flight In the cloud

Slide 7

Slide 7 text

Atlas App Services

Slide 8

Slide 8 text

Atlas & App Services Database Realm Database Atlas Device Sync

Slide 9

Slide 9 text

Atlas & App Services Database Realm Database Atlas Device Sync GraphQL Data API Functions

Slide 10

Slide 10 text

Atlas & App Services Database Realm Database Atlas Device Sync GraphQL Data API Functions Atlas Search Drivers

Slide 11

Slide 11 text

FUTURE WORK.

Slide 12

Slide 12 text

The MongoDB Database

Slide 13

Slide 13 text

The Document Model

Slide 14

Slide 14 text

{ "_id": ObjectId("573a1390f29313caabcd4135"), "title": "Blacksmith Scene", "plot": "Three men hammer on an anvil and pass ...", "cast": [ "Charles Kayser", "John Ott" ], "directors": [ "William K.L. Dickson" ], "lastupdated": "2015-08-26 00:03:50.133000000", "year": 1893, "imdb": { "rating": 6.2, "votes": 1189, "id": 5 } } A Document

Slide 15

Slide 15 text

No content

Slide 16

Slide 16 text

{ "_id": ObjectId("573a1390f29313caabcd4135"), "title": "Blacksmith Scene", "plot": "Three men hammer on an anvil and pass ...", "cast": [ "Charles Kayser", "John Ott" ], "directors": [ "William K.L. Dickson" ], "lastupdated": "2015-08-26 00:03:50.133000000", "year": 1893, "imdb": { "rating": 6.2, "votes": 1189, "id": 5 } } A Document

Slide 17

Slide 17 text

{ "_id": ObjectId("573a1390f29313caabcd4135"), "title": "Blacksmith Scene", "plot": "Three men hammer on an anvil and pass ...", "cast": [ "Charles Kayser", "John Ott" ], "directors": [ "William K.L. Dickson" ], "lastupdated": "2015-08-26 00:03:50.133000000", "year": 1893, "imdb": { "rating": 6.2, "votes": 1189, "id": 5 } } A Document

Slide 18

Slide 18 text

{ "_id": ObjectId("573a1390f29313caabcd4135"), "title": "Blacksmith Scene", "plot": "Three men hammer on an anvil and pass ...", "cast": [ "Charles Kayser", "John Ott" ], "directors": [ "William K.L. Dickson" ], "lastupdated": "2015-08-26 00:03:50.133000000", "year": 1893, "imdb": { "rating": 6.2, "votes": 1189, "id": 5 } } Values Can be Scalar

Slide 19

Slide 19 text

{ "_id": ObjectId("573a1390f29313caabcd4135"), "title": "Blacksmith Scene", "plot": "Three men hammer on an anvil and pass ...", "cast": [ "Charles Kayser", "John Ott" ], "directors": [ "William K.L. Dickson" ], "lastupdated": "2015-08-26 00:03:50.133000000", "year": 1893, "imdb": { "rating": 6.2, "votes": 1189, "id": 5 } } Array Values

Slide 20

Slide 20 text

{ "_id": ObjectId("573a1390f29313caabcd4135"), "title": "Blacksmith Scene", "plot": "Three men hammer on an anvil and pass ...", "cast": [ "Charles Kayser", "John Ott" ], "directors": [ "William K.L. Dickson" ], "lastupdated": "2015-08-26 00:03:50.133000000", "year": 1893, "imdb": { "rating": 6.2, "votes": 1189, "id": 5 } } Subdocument Values

Slide 21

Slide 21 text

Querying MongoDB

Slide 22

Slide 22 text

Rust R Client drivers

Slide 23

Slide 23 text

Drivers Connecting to your database Realm SDK SQL Connector GraphQL Data API Functions

Slide 24

Slide 24 text

db.collection.findOne() Match a single document. db.collection.find() Match, sort, or count multiple documents. db.collection.aggregate() Match, combine & aggregate documents. The MongoDB Query API

Slide 25

Slide 25 text

{ "_id": { "$oid": "573a1390f29313caabcd4135" }, "plot": "Three men hammer on an anvil and pass a bottle of beer around.", "genres": [ "Short" ], "runtime": 1, "cast": [ db.movies.findOne({ "title": "Blacksmith Scene" }) Find One Document

Slide 26

Slide 26 text

db.movies.find({ "year": 2010 }); [{ "_id": { "$oid": "573a139cf29313caabcf6fb1" }, "plot": "A lonely obese nurse, working at a hospital terminal ward, is reminded of her childhood friend Adrienn Pal and wants to track her down.", "genres": [ "Drama" ], "runtime": 136, "cast": [ "èva Gèbor", "Istvèn Znamenèk", "èkos Horvèth", "Lia Pokorny" ], "num_mflix_comments": 1, Find Many Documents

Slide 27

Slide 27 text

db.movies.find({ "year": { "$gte": 2000, "$lt": 2010 } }) [{ "_id": { "$oid": "573a139cf29313caabcf6fb1" }, "plot": "A lonely obese nurse, working at a hospital terminal ward, is reminded of her childhood friend Adrienn Pal and wants to track her down.", "genres": [ "Drama" ], "runtime": 136, "cast": [ "èva Gèbor", "Istvèn Znamenèk", "èkos Horvèth", "Lia Pokorny" ], "num_mflix_comments": 1, Find Many Documents

Slide 28

Slide 28 text

And there's more… ● Aggregation queries ● Optimize your queries with indexes ● Ensure consistency with transactions ● Store geographical data with GeoJSON ● Store metrics with time series collections

Slide 29

Slide 29 text

Atlas App Services

Slide 30

Slide 30 text

Atlas App Services

Slide 31

Slide 31 text

Let’s build a mobile app

Slide 32

Slide 32 text

Event Manager App

Slide 33

Slide 33 text

Data synchronization JSON ORM NATIVE OBJECT MSG QUEUE BACKEND OBJECT REST CALL TO API COMPLEX NETWORK HANDLING & CONFLICT RESOLUTION POTENTIAL APP CRASH OFFLINE? INVALID DATA? SERVER ERROR? TIMED OUT? Backend database Mobile devices with local data High Level Architecture

Slide 34

Slide 34 text

High Level Architecture Mobile App Atlas Device Sync MongoDB Atlas Live Update Realm Mobile DB Registration/Login Create Events Manage Talks

Slide 35

Slide 35 text

Setup our cloud database - Atlas database

Slide 36

Slide 36 text

Atlas

Slide 37

Slide 37 text

Atlas

Slide 38

Slide 38 text

Mobile App Atlas Device Sync MongoDB Atlas Live Update Realm Mobile DB Registration/Login Create Events Manage Talks How to connect to our Atlas Database?

Slide 39

Slide 39 text

How to connect to our Atlas Database?

Slide 40

Slide 40 text

Atlas App Service

Slide 41

Slide 41 text

Setting up Device Sync

Slide 42

Slide 42 text

How to a connect client apps with Atlas App Service? Realm SDK Swift/SwiftUI Dart/Flutter Kotlin/KMM Java JavaScript .NET

Slide 43

Slide 43 text

Realm By MongoDB ACID Object database Easy in-language model definitions Notification Encryption Sync with MongoDB Atlas Fast w/ Zero-copy and lazy loading

Slide 44

Slide 44 text

Show me the code !! Check out the github repo:

Slide 45

Slide 45 text

How to a connect Mobile App with Atlas App? Code snippet for setting up connection with Atlas App

Slide 46

Slide 46 text

How to a connect Mobile App with Atlas App? Code snippet for setting up connection with Atlas App

Slide 47

Slide 47 text

Connecting Realm & Flexible Sync Code snippet for setting up connection with Atlas App

Slide 48

Slide 48 text

Creating a model

Slide 49

Slide 49 text

Saving Info Code snippet

Slide 50

Slide 50 text

No content

Slide 51

Slide 51 text

No content

Slide 52

Slide 52 text

Adding Tigger

Slide 53

Slide 53 text

Adding Tigger

Slide 54

Slide 54 text

Adding a cloud function Code snippet

Slide 55

Slide 55 text

How to update the model Code snippet for update

Slide 56

Slide 56 text

Atlas Sync Updating Model in action Updating Model in action

Slide 57

Slide 57 text

Realm MongoDB Atlas MongoDB auto-syncs between device and cloud Atlas Device Sync SDK writes transaction The Realm SDK writes the transaction, commiting the object to disk, and sends the changes to the server Insert into collection MongoDB document inserted into the Atlas collection User makes change User logs into the app and makes an edit Object Conversion Atlas Device Sync automatically converts the Realm object to a MongoDB document Change Detected Document changed by another user is picked up by changeStreams and forwarded to Atlas Device Sync Object Conversion Atlas Device Sync automatically translates MongoDB documents to Realm objects and syncs down to the device Notification Realm commits the change to disk. A notification is fired and the UI is updated displaying the new change to the user

Slide 58

Slide 58 text

Observing Data Change

Slide 59

Slide 59 text

Seamless Sync of the box

Slide 60

Slide 60 text

MongoDB provides the easiest way to build & scale mobile apps Built-in cloud sync, conflict resolution, security, & permissions Mobile database with built-in ORM and network handling MongoDB’s cloud database Atlas Realm Atlas Device Sync Swift/SwiftUI Dart/Flutter Kotlin/KMM Java JavaScript .NET

Slide 61

Slide 61 text

And provides a single data layer shared across all platforms Built-in cloud sync, conflict resolution, security, & permissions MongoDB’s cloud database Atlas Atlas Device Sync

Slide 62

Slide 62 text

Leading innovators leverage MongoDBʼs mobile & device solution

Slide 63

Slide 63 text

Q&A coming up ... What Next !

Slide 64

Slide 64 text

Please share your feedback. Thank you! Q&A coming up next... Survey Time