You are previewing RavenDB 2.x Beginner's Guide.
O'Reilly logo
RavenDB 2.x Beginner's Guide

Book Description

For .NET developers who want to acquire document-oriented database skills, there is no better introduction to RavenDB than this book. It covers all the bases in a user-friendly style that makes learning fast and easy.

  • Build high performance NoSQL .NET based applications with step-by-step practical examples

  • Master advanced RavenDB indexes and queries

  • Create objects in .NET and map them to RavenDB

  • In Detail

    RavenDB is a second generation document database written in .NET, offering a flexible data model designed to address requirements coming from real-world systems. It is different from the other document databases around, as with RavenDB you can get up and running in a few minutes, and that includes grasping all the basics. It allows you to build high-performance, low-latency applications with ease and efficiency.

    RavenDB 2.x Beginner’s Guide introduces RavenDB concepts and teaches you everything, right from installing RavenDB, to creating documents, and querying indexes. This book will help you take advantage of powerful, document-oriented NoSQL databases and build a solid foundation on which you can create your .NET applications.

    This book presents RavenDB, the .NET document-oriented NoSQL database, through a series of clear and practical exercises that will help you to take advantage of this database server.

    The book starts off with an introduction to RavenDB and its Management Studio. You will then move ahead and learn how to quickly and efficiently build high performance, NoSQL document-oriented .NET applications using the .NET client API or the HTTP REST API. Next, Dynamic and static indexes that use map/reduce to process datasets are covered. You will then see how to create and query these indexes, with the help of detailed examples. You will also learn how to deploy your RavenDB server in a production environment and how to optimize and secure it.

    With numerous practical examples, RavenDB 2.x Beginner’s Guide teaches you everything you need to know for building high performance .NET document-oriented NoSQL databases.

    Table of Contents

    1. RavenDB 2.x Beginner's Guide
      1. Table of Contents
      2. RavenDB 2.x Beginner's Guide
      3. Credits
      4. About the Author
      5. Acknowledgments
      6. About the Reviewers
      7. www.PacktPub.com
        1. Support files, eBooks, discount offers and more
          1. Why Subscribe?
          2. Free Access for Packt account holders
      8. Preface
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Conventions
        5. Reader feedback
        6. Customer support
          1. Downloading the example code
          2. Errata
          3. Piracy
          4. Questions
      9. 1. Getting Started with RavenDB
        1. Understanding the basics of NoSQL Databases
          1. Types of NoSQL Databases
        2. What is RavenDB?
        3. From relational databases to RavenDB
        4. Why RavenDB?
        5. How RavenDB works?
        6. Anatomy of a Document
        7. The JSON format
        8. Downloading and installing RavenDB
          1. What do you need to run RavenDB?
        9. Time for action – downloading and installing RavenDB
          1. What just happened?
        10. Running RavenDB server in the Console mode
          1. Exploring the Start.cmd file
        11. Time for action – exploring the Start.cmd file
          1. What just happened?
          2. Configuring the RavenDB server
          3. Launching the RavenDB server in the Console mode
        12. Time for action – launching RavenDB in the Console mode
          1. What just happened?
          2. Creating your first RavenDB database
        13. Time for action – creating a new database and adding sample data
          1. What just happened?
          2. Shutting down the RavenDB server in the Console mode
        14. Time for action – shutting down RavenDB
          1. What just happened?
          2. Have a go hero – connecting to a RavenDB server on a networked computer
        15. Summary
      10. 2. RavenDB Management Studio
        1. Introducing the RavenDB Management Studio
        2. Management Studio's multi-databases feature
          1. Creating a new database
        3. Time for action – creating a new database
          1. What just happened?
        4. Management Studio's Documents screen
        5. Time for action – creating your first document
          1. What just happened?
        6. Time for action – loading a document
          1. What just happened?
        7. Time for action – searching for a document
          1. What just happened?
          2. Exporting a database to a CSV file
        8. Time for action – exporting documents to a CSV file
          1. What just happened?
          2. RavenDB documents metadata
        9. Time for action – adding a custom metadata key
          1. What just happened
        10. Management Studio's Collections screen
        11. Time for action – modifying a document
          1. What just happened?
        12. Management Studio's Indexes screen
          1. Creating your first Index
        13. Time for action – creating an Index
          1. What just happened?
          2. Executing a query against an Index
        14. Time for action – querying an Index
          1. What just happened?
          2. Editing an Index
        15. Time for action – editing an Index
          1. What just happened?
          2. The Query Index screen
        16. Time for action – querying an Index
          1. What just happened?
          2. Creating a Dynamic Query
        17. Time for action – creating a Dynamic Query
          1. What just happened?
        18. Management Studio's Patch screen
        19. Time for action – patching a document
          1. What just happened?
          2. Have a go hero – patching the Orders collection
        20. Management Studio's Tasks screen
        21. Time for action – importing external data using a CSV file
          1. What just happened?
          2. Have a go hero – exporting documents from different views
        22. Management Studio's Alerts screen
        23. Management Studio's Logs screen
        24. Time for action – exploring the Logs screen
          1. What just happened?
        25. Viewing the database settings
        26. Time for action – viewing the database's active bundles
          1. What just happened?
          2. The System database settings
        27. Time for action – opening the System database's Settings page
          1. What just happened?
        28. Bundles
        29. Time for action – enabling the Periodic Backup feature
          1. What just happened?
        30. Doing more with the Management Studio
          1. Choosing the columns
        31. Time for action – customizing the columns
          1. What just happened?
          2. Copying the document to clipboard
        32. Time for action – copying the data document to the clipboard
          1. What just happened?
          2. Deleting the Documents, Collections, Indexes, or Databases
        33. Time for action – deleting a database using the Management Studio
          1. What just happened?
        34. Summary
      11. 3. RavenDB.NET Client API
        1. The RavenDB .NET Client API
        2. Setting up your development environment
        3. Time for action – installing NuGet Package Manager
          1. What just happened?
        4. Creating a simple application
        5. Time for action – adding RavenDB Client to a Visual Studio project
          1. What just happened?
        6. Connecting to RavenDB
        7. Time for action – connecting to RavenDB
          1. What just happened?
            1. Interacting with RavenDB using the .NET Client API
        8. Loading a document
        9. Time for action – loading a document
          1. What just happened?
          2. Have a go hero – loading multiple documents
        10. Inserting a new Document
        11. Time for action – inserting a new document
          1. What just happened?
        12. Updating a document
        13. Time for action – updating a document
          1. What just happened?
        14. Deleting a document
        15. Time for action – deleting a document
          1. What just happened?
        16. Querying a documents collection
        17. Time for action – querying a documents collection
          1. What just happened?
          2. Have a go hero – querying a collection using lambda expression
          3. Pop quiz – RavenDB .NET Client API
        18. Summary
      12. 4. RavenDB Indexes and Queries
        1. The RavenDB indexes
        2. RavenDB Map/Reduce implementation
          1. The types of RavenDB indexes
        3. RavenDB dynamic indexes
          1. Querying dynamic indexes
        4. Time for action – querying a dynamic index
          1. What just happened?
          2. Querying temporary indexes
        5. Time for action – querying a temporary index
          1. What just happened?
          2. Managing temporary indexes
        6. Time for action – managing temporary indexes
          1. Have a go hero – creating projections using Linq queries
        7. RavenDB static indexes
          1. Creating your first Map function
        8. Time for action – defining a Map function for an index
          1. What just happened?
          2. Creating your first Reduce function
        9. Time for action – adding a Reduce function to an index
          1. What just happened?
          2. Using TransformResults in an index
        10. Time for action – adding a TransformResults to the index
          1. What just happened?
          2. Have a go hero – creating Map/Reduce/Transform index
        11. RavenDB stale indexes
          1. Checking for stale index results
        12. Time for action – checking for stale index results
          1. What just happened?
          2. Waiting for non-stale index results
        13. Time for action – explicitly waiting for a non-stale index result
          1. What just happened?
          2. Have a go hero – display all index names
          3. Pop quiz – RavenDB and Map/Reduce
        14. Summary
      13. 5. Advanced RavenDB Indexes and Queries
        1. The RavenDB AbstractIndexCreationTask class
        2. Creating indexes using the AbstractIndexCreationTask class
        3. Time for action – creating indexes using AbstractIndexCreationTask class
          1. What just happened?
          2. Using AbstractIndexCreationTask and ReduceResult
        4. Time for action – creating indexes using the ResultReduce class
          1. What just happened?
          2. Have a go hero – query the Cities_SameName index
          3. Using the TransformResults function
        5. Time for action – using the TransformResults function
          1. What just happened?
        6. Creating multimap indexes
        7. Time for action – creating multimap indexes
          1. What just happened?
          2. Using indexes to search over documents
        8. Full-text and exact matching search
        9. Time for action – creating a full-text searching index
          1. What just happened?
          2. Have a go hero – adding exact matching searching index class
          3. Multiple field searching and search options
        10. Time for action – creating multifields searching index
          1. What just happened?
          2. Using a custom analyzer for searching
        11. Time for action – using a custom analyzer
          1. What just happened?
        12. Paging a query's results
        13. Time for action – paging a query's results
          1. What just happened?
          2. Pop quiz – searching the right way
        14. Summary
      14. 6. Advanced RavenDB Document Capabilities
        1. RavenDB attachments
          1. Storing attachments
        2. Time for action – using attachments to store images
          1. What just happened?
          2. Retrieving attachments
        3. Time for action – retrieving stored attachments
          1. What just happened?
          2. Have a go hero – retrieving country flag image attachment
          3. Update and delete attachments
        4. Time for action – retrieving and updating anattachment's metadata
          1. What just happened?
          2. Have a go hero – updating and deleting attachments
        5. Handling documents relationships
          1. Using Include to preload documents
        6. Time for action – using Include to reduce query calls
          1. What just happened?
          2. Have a go hero – using Include with a query
          3. Indexing related documents
        7. Time for action – indexing related documents
          1. What just happened?
        8. Patching documents
          1. Patching documents using ScriptedPatchRequest
        9. Time for action – applying a ScriptedPatchRequest
          1. What just happened?
          2. Patching documents using PatchRequest
        10. Time for action – using PatchRequest to add a new field to a document
          1. What just happened?
          2. Have a go hero – adding a FlagId field to the Countries collection
        11. Summary
      15. 7. RavenDB Administration
        1. RavenDB configuration options
          1. RavenDB optimizing key concepts
        2. Time for action – optimizing RavenDB performances
          1. What just happened?
        3. Backing up RavenDB databases
          1. Backing up databases using the RavenDB backup tool
        4. Time for action – backing up the World database
          1. What just happened?
          2. Have a go hero – creating an incremental backup
          3. Backing up a database using VSS
          4. Backing up a database using Management Studio
        5. Time for action – backing up the World database using Management Studio
          1. What just happened?
        6. Restoring RavenDB databases
          1. Restoring databases using the command line
        7. Time for action – restoring the World database using the command line
          1. What just happened?
          2. Restoring databases using Management Studio
        8. Time for action – restoring the World database using Management Studio
          1. What just happened?
        9. Exporting and importing RavenDB databases
          1. Exporting RavenDB databases
        10. Time for action – exporting the World database using Smuggler
          1. What just happened?
          2. Importing RavenDB databases
        11. Time for action – importing the World database using Smuggler
          1. What just happened?
          2. Have a go hero – importing/exporting using the Client .NET API
          3. Deleting RavenDB databases
        12. RavenDB server bundles
          1. Replication bundles
            1. RavenDB replication bundle
        13. Time for action – creating a master to slave database replication
          1. What just happened?
          2. Have a go hero – creating World database replication
            1. SQL replication bundle
        14. Time for action – replicating to Microsoft SQL Express
          1. What just happened?
          2. Have a go hero – activating and using the IndexReplication bundle
          3. RavenDB authorization bundle
        15. Time for action – authenticating and authorizing
          1. What just happened?
          2. Have a go hero – activating the authorization bundle
        16. Enabling RavenDB logging
        17. Time for action – enabling RavenDB logging
          1. What just happened?
        18. Upgrading the RavenDB server
        19. Time for action – upgrading the RavenDB server
          1. Pop quiz – RavenDB administration
        20. Summary
      16. 8. Deploying RavenDB
        1. RavenDB deployment strategies
        2. Running RavenDB as a Windows Service
          1. Installing the RavenDB service
        3. Time for action – running RavenDB as a Windows Service
          1. What just happened?
          2. Have a go hero – setting a particular host name to RavenDB
          3. Uninstalling the RavenDB service
        4. Time for action – uninstalling the RavenDB service
          1. What just happened?
        5. RavenDB and IIS
          1. Running RavenDB from an IIS virtual directory
        6. Time for action – running RavenDB from an IIS virtual directory
          1. What just happened?
          2. Running RavenDB as an IIS application
        7. Time for action – running RavenDB as an IIS application
          1. What just happened?
        8. RavenDB Embedded mode
          1. Embedding RavenDB
        9. Time for action – running RavenDB in Embedded mode
          1. What just happened?
          2. Memory embedded RavenDB
        10. Time for action – running RavenDB inmemory
          1. What just happened?
          2. Pop quiz – searching the right way
        11. Summary
      17. 9. Scaling-out RavenDB
        1. What is scaling-out?
        2. RavenDB sharding
        3. Time for action – preparing RavenDB for sharding
          1. What just happened?
          2. RavenDB sharding – the blind mode
        4. Time for action – implementing RavenDB sharding (the blind mode)
          1. What just happened?
          2. RavenDB sharding – the smart mode
        5. Time for action – implementing RavenDB sharding (the smart mode)
          1. What just happened?
          2. Have a go hero – implementing the Shard ID translator function
        6. Mixing sharding and replication
          1. Have a go hero – mixing sharding and replication
          2. Pop Quiz – scaling-out RavenDB
        7. Summary
      18. 10. RavenDB Profiling
        1. What is profiling?
          1. RavenDB profiler
        2. Time for action – enabling the RavenDB profiler
          1. What just happened?
          2. Using the profiler information
          3. Have a go hero – profiling the RavenDB shards
          4. RavenDB visual host
        3. Time for action – running the RavenDB visual host
          1. What just happened?
        4. RavenDB workload simulator/stress tests
        5. Summary
      19. 11. RavenDB HTTP API
        1. The RavenDB HTTP API
        2. Understanding REST
        3. Anatomy of the RavenDB REST request URL
        4. The RESTClient tool
        5. Time for action – downloading and launching the RESTClient tool
          1. What just happened?
        6. The GET request
        7. Time for action – performing a GET request
          1. What just happened?
          2. Have a go hero – retrieving the databases list
        8. The PUT request
        9. Time for action – granting access to perform a PUT request
          1. What just happened?
        10. Time for action – performing a PUT request
          1. What just happened?
        11. The POST request
        12. Time for action – performing a POST request
          1. What just happened?
          2. Have a go hero – retrieving the inserted document
        13. The PATCH request
        14. Time for action – performing a Patch request
          1. What just happened?
          2. Have a go hero – removing the document properties with a PATCH request
        15. The DELETE request
        16. Time for action – performing a Delete request
          1. What just happened?
        17. Getting multiple documents with a single request
        18. Time for action – getting multiple documents within a single request
          1. What just happened?
        19. Querying an Index
        20. Time for action – querying an Index
          1. What just happened?
          2. Pop Quiz – deep into RavenDB
        21. Summary
      20. 12. Putting It All Together
        1. A word about ASP.NET MVC
        2. Application architecture key concepts
        3. Creating an ASP.NET MVC 4 project with RavenDB
          1. Getting connected to RavenDB
        4. Time for action – creating the World ASP.NET MVC application
          1. What just happened?
          2. Adding Models
        5. Time for action – adding the World application's Models
          1. What just happened?
          2. Adding Controllers
        6. Time for action – adding the Controllers
          1. What just happened?
          2. Have a go hero – adding the CityController class
          3. Adding Views
        7. Time for action – adding the Views
          1. What just happened?
          2. Have a go hero – adding the CityController Views
          3. Launching the World application
        8. Time for action – launching the World application
          1. What just happened?
        9. Doing more with the World application
          1. Creating the RavenDB Indexes automatically
        10. Time for action – creating indexes automatically
          1. What just happened?
          2. Adding a page navigation bar
        11. Time for action – the paging query <Country>() result
          1. What just happened?
          2. Adding the Country master/details View
        12. Time for action – creating the Country master/details View
          1. What just happened?
          2. Adding the search Cities view
        13. Time for action – implementing the Search view
          1. What just happened?
          2. Have a go hero – creating the Search view with paginated result
        14. Summary
      21. 13. Pop Quiz Answers
        1. Chapter 3, RavenDB.NET Client API
          1. Pop quiz – RavenDB .NET Client API
        2. Chapter 4, RavenDB Indexes and Queries
          1. Pop quiz – RavenDB and Map/Reduce
        3. Chapter 5, Advanced RavenDB Indexes and Queries
          1. Pop quiz – searching the right way
        4. Chapter 7, RavenDB Administration
          1. Pop quiz – RavenDB administration
        5. Chapter 9, Scaling-out RavenDB
          1. Pop quiz – scaling-out RavenDB
        6. Chapter 11, RavenDB HTTP API
          1. Pop quiz – deep into RavenDB
      22. Index