Intro to MongoDB
I finally was able to write down some of my notes from watching the Pluralsight: Intro to MongoDB course. These are just my notes but I absolutely recommend you watch the course and signup for Pluralsight. MSDN subscriptions typically come with some free time with Pluralsight.
Jump start your learning and good luck!
Jump start your learning and good luck!
Into to MongoDB
Server
Query/Manipulate
Indexing
No Schema
Single Document write scope - No locking
Eventual Consistency - multiple options
Fire
and Forget
Majority
Eventual
Consistency
Scalability
no
Schema - Really -> No schema Enforcement
Server Setup
Open
Source (C++)
Mongod
just
Create data file/ Run
mongod
--install {installs as service}
net
start MongoDB
MongoDB Shell
Commands
show
dbs
use
foo
db
-> shows connected db
help
-> shows all commands
Like
SQL Command prompt
JavaScript
Interrupter
Can write
up your own Editor
-
Sublime
-
NotePad ++
mongorc.js
-> always runs
Replica Set
Primary
-> Secondary & Arbiter (helps to
determine who takes over w/ issues)
Can run
all on one Server
Pro
-> Set at least 3 servers
Saving Data
storing
Data
BSON -
Binary JSON
Rules
_id
field -> must have
16
Megabytes per document
ObjectID
- involves timestamp in it
Insertion
is ascending
db.foo.save({})
db.foo.insert({})
-> will throw for duplicate key if saving with specific ID
db.foo.update(
query, update, options )
Indexing
index
collection
usage
of indexing
db.system.indexes.find()
db.dropIndex("")
Comments