MongoDB And C#
About me          Serdar Büyüktemiz              @hserdarb           altdotnetturkiyeSoftware Developer @ Mavituna Security
Why MongoDB?• Popular • Easy to use nosql• Good for web projects• High performance (No joins and embedding  makes reads a...
RDBMS => MongoDBRDBMS                   MongoDBTable, View             CollectionRow                     JSON DocumentInde...
Awesome web tutorialhttp://tutorial.mongly.com/tutorialThanks to Karl Seguin
Official C# Driver
Connecting to MongoDB• If DB does not exists driver will create one for  you•   http://www.mongodb.org/display/DOCS/CSharp...
MongoCollection
What is BSON?• MongoDB uses BSON as the data storage and  network transfer format for "documents".• Short for Binary JSON•...
Working with POCOs• Things can be really easy for you if you follow  these rules for your pocos  – Has a public no-argumen...
Let’s add the first item
Let’s find (Query) it
Demo• https://bitbucket.org/serdarb/mongo-c-driver-poc• https://github.com/serdarb/Mongo-C--Driver-POC
Creating indexes for performance
A tip for better indexing• Run mongodb with notablescan parameter  and be sure your your queries are not making  full tabl...
Sources•   http://www.mongodb.org/display/DOCS/Introduction•   http://mongly.com/Multiple-Collections-Versus-Embedded-Docu...
Upcoming SlideShare
Loading in …5
×

Mongo db first steps with csharp

1,447 views
1,351 views

Published on

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,447
On SlideShare
0
From Embeds
0
Number of Embeds
5
Actions
Shares
0
Downloads
15
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Mongo db first steps with csharp

  1. 1. MongoDB And C#
  2. 2. About me Serdar Büyüktemiz @hserdarb altdotnetturkiyeSoftware Developer @ Mavituna Security
  3. 3. Why MongoDB?• Popular • Easy to use nosql• Good for web projects• High performance (No joins and embedding makes reads and writes fast)• High availability (Replicated servers with automatic master failover)• Easy scalability (Automatic sharding)
  4. 4. RDBMS => MongoDBRDBMS MongoDBTable, View CollectionRow JSON DocumentIndex IndexJoin Embeded DocumentPartition ShardPartition Key Shard Key
  5. 5. Awesome web tutorialhttp://tutorial.mongly.com/tutorialThanks to Karl Seguin
  6. 6. Official C# Driver
  7. 7. Connecting to MongoDB• If DB does not exists driver will create one for you• http://www.mongodb.org/display/DOCS/CSharp+Driver+Tutorial#CSharpDriverTut orial-Connectionstrings• mongodb://[username:password@]hostname[:port][/[database][?options]]
  8. 8. MongoCollection
  9. 9. What is BSON?• MongoDB uses BSON as the data storage and network transfer format for "documents".• Short for Binary JSON• http://bsonspec.org/• http://www.mongodb.org/display/DOCS/BSON
  10. 10. Working with POCOs• Things can be really easy for you if you follow these rules for your pocos – Has a public no-argument constructor – Has a public get set property for each value you want to have serialized
  11. 11. Let’s add the first item
  12. 12. Let’s find (Query) it
  13. 13. Demo• https://bitbucket.org/serdarb/mongo-c-driver-poc• https://github.com/serdarb/Mongo-C--Driver-POC
  14. 14. Creating indexes for performance
  15. 15. A tip for better indexing• Run mongodb with notablescan parameter and be sure your your queries are not making full table scans... – You get exceptions if a query needs a table scan, it gives you a chance to fix your indexes on development time.
  16. 16. Sources• http://www.mongodb.org/display/DOCS/Introduction• http://mongly.com/Multiple-Collections-Versus-Embedded-Documents/• http://openmymind.net/mongodb.pdf• http://www.mongodb.org/display/DOCS/Padding+Factor• https://github.com/mongodb/mongo• http://www.codeproject.com/Articles/273145/Using-MongoDB-with-the- Official-Csharp-Driver• http://stackoverflow.com/questions/4067197/mongodb-and-joins• http://www.mongodb.org/display/DOCS/Schema+Design#SchemaDesign- EmbeddingandLinking• http://docs.mongodb.org/manual/applications/database-references/• http://www.10gen.com/presentations?programming_lang=46• https://speakerdeck.com/mongodb/whats-new-in-the-net-driver• http://learnmongo.com/

×