Jeff Lemmerman Matt Chimento Medtronic Confidential 1 9th
Annual CodeFreeze Symposium Medtronic Energy and Component
Center
Slide 2
2 MECC est. 1976 MECC Components Batteries Defibrillation
Capacitors Feedthroughs Glass/ Metal Feedthroughs Precision Molding
and Extrusion Census 1200 Employees Plant Size 190,000 Square Feet
40,000 Manufacturing 15,000 R&D Labs 38,000 Office 97,000
Common, Support, Warehouse
Slide 3
About MongoDB Background Founded in 2007 as 10Gen First release
of MongoDB in 2009 $223M+ in funding MongoDB Core server Native
drivers Version 2.4.9 released 1/10/14 Subscriptions, Consulting,
Training Monitoring (MMS)
Slide 4
RDBMS Strengths Data stored is very compact Rigid schemas have
led to powerful query capabilities Data is optimized for joins and
storage Robust ecosystem of tools, libraries, integrations 40+
years old!
Slide 5
Enter Big Data Gartner defines it with 3Vs Volume Vast amounts
of data being collected Variety Evolving data Uncontrolled formats,
no single schema Unknown at design time Velocity Inbound data speed
Fast read/write operations Low latency
Slide 6
Is this a BIG data problem? 6
Slide 7
Where stored? 7
Slide 8
Mapping Big Data to RDBMS Difficult to store uncontrolled data
formats Scaling via big iron or custom data marts/partitioning
schemes Schema must be known at design time Impedance mismatch with
agile development and deployment techniques Doesnt map well to
native language constructs
Slide 9
Key Features Data stored as documents (JSON-like BSON)
Flexible-schema In schema design, think about optimizing for read
vs. storage Full CRUD support (Create, Read, Update, Delete) Atomic
in-place updates Ad-hoc queries: Equality, RegEx, Ranges,
Geospatial Secondary indexes Replication redundancy, failover
Sharding partitioning for read/write scalability Terminology
Collection = Table Index = Index Document = Row Column = Field
Joining = Embedding & Linking
Slide 10
Our experience with MongoDB Consulting/Training has been
excellent Support agreement has been under-utilized Emails for
security updates etc. are prompt Release cycle is frequent Mongo
Monitoring Service Potential concerns storing db stats externally
MongoDB Certification now available New course coming soon in
Udacity
Slide 11
Building First C# Application CRUD operations for domain class
Component Create new Visual Studio 2010/2012 project Install C#
driver currently 1.8.3 Domain class annotations Authentication
Replication Sharding 11
Slide 12
Medtronic Confidential 12
Slide 13
13
Slide 14
How is data retrieved? 14
Slide 15
Loading Data Into Central Repository 15
Slide 16
Download/Install MongoDB 16 mongodb.org/downloads
Slide 17
Install MongoDB as Windows Service 17
Slide 18
Create Default Data Directory 18 C:\data\db Start Mongod
C:\MongoDB\bin\mongod.exe
Slide 19
MongoDB Shell 19 C:\MongoDB\bin\mongo.exe
Slide 20
Creating Components 20.insert() will always try to create new
document.save() if _id already exists will update If document
doesnt have _id field it is added
Slide 21
Reading Components 21
Slide 22
Reading Components 22 Returns Null
Slide 23
Updating Components 23 $set keyword used for partial updates
Without $set keyword entire document is replaced {multi : true} to
update multiple documents
Slide 24
Deleting Components 24 Works like.find() Drops collection Drops
database
Updating Components Save() 29 Save sends entire document back
to server
Slide 30
Updating Components Update() 30 Update only sends changes
Slide 31
Deleting Components 31 Needed to add reference to Repo
class
Slide 32
Automapping 32
Slide 33
33
Slide 34
Authentication 34 Clients on localhost connect as admin by
default Start mongod with config option to disable Create read-only
user and a write user Start mongod with these config options
Slide 35
Replica Sets
Slide 36
Scaling Reads
Slide 37
Sharding
Slide 38
Key Points CHOOSE WISELY: SHARD KEY CANNOT BE CHANGED! All
documents in sharded collection must include the shard key Shard
key must be an indexed field Queries that sort by the shard key are
much more efficient Mongos handles routing to the correct shard Key
Points CHOOSE WISELY: SHARD KEY CANNOT BE CHANGED! All documents in
sharded collection must include the shard key Shard key must be an
indexed field Queries that sort by the shard key are much more
efficient Mongos handles routing to the correct shard Sharding
Slide 39
What makes a good shard key? Sharding
Slide 40 ">
Key Learnings Working Set < Memory
ISODate("2012-09-25T03:00:23Z") Use UTC Queries must match data
type string vs. integer Download and use other MongoDB tools
(MongoVUE) Do not convert query results to List
Slide 41
Gaps Enterprise acceptance of new approach Integration with
off-the-shelf reporting and analytics User interface for managing
the database cluster Developer familiarity with JSON and MongoDB 21
CFR Part 11 Compliance
Collect and store raw data Medtronic Confidential 43
Slide 44
Databases Are Not ARDS Medtronic Confidential 44 RDBMS
Optimized For Storage
Slide 45
Waveform Data Medtronic Confidential 45
Slide 46
ObjectId Special 12-byte BSON type that guarantees uniqueness
within the collection. The ObjectID is generated based on
timestamp, machine ID, process ID, and a process-local incremental
counter. MongoDB uses ObjectId values as the default values for _id
fields.BSONcollection_id 46
Slide 47
Indexing 47 Without indexes queries must perform a table scan
(every document) All collections index on the _id field
Slide 48
Backup/Restore 48 One option is to use mongodump.exe /
mongorestore.exe