Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Mongo db first steps with csharp


Published on

Published in: Technology
  • Be the first to comment

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 tutorial to Karl Seguin
  6. 6. Official C# Driver
  7. 7. Connecting to MongoDB• If DB does not exists driver will create one for you• 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••
  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••
  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•••••• Official-Csharp-Driver•• EmbeddingandLinking••••