RavenDB 2.x Beginner's Guide

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.

RavenDB 2.x Beginner's Guide

Khaled TannirSeptember 2013

1 customer reviews

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.

Mapt Subscription

FREE

$29.99/m after trial

eBook

$21.00

RRP $29.99

Save 29%

Print + eBook

$49.99

RRP $49.99

What do I get with a Mapt Pro subscription?

Unlimited access to all Packt’s 5,000+ eBooks and Videos

Early Access content, Progress Tracking, and Assessments

1 Free eBook or Video to download and keep every month after trial

What do I get with an eBook?

Download this book in EPUB, PDF, MOBI formats

DRM FREE - read and interact with your content when you want, where you want, and how you want

Access this title in the Mapt reader

What do I get with Print & eBook?

Get a paperback copy of the book delivered to you

Download this book in EPUB, PDF, MOBI formats

DRM FREE - read and interact with your content when you want, where you want, and how you want

Access this title in the Mapt reader

What do I get with a Video?

Download this Video course in MP4 format

DRM FREE - read and interact with your content when you want, where you want, and how you want

Book Details

ISBN 139781783283798

Paperback356 pages

Book Description

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

Chapter 1: Getting Started with RavenDB

Understanding the basics of NoSQL Databases

What is RavenDB?

From relational databases to RavenDB

Why RavenDB?

How RavenDB works?

Anatomy of a Document

The JSON format

Downloading and installing RavenDB

Time for action – downloading and installing RavenDB

Running RavenDB server in the Console mode

Time for action – exploring the Start.cmd file

Time for action – launching RavenDB in the Console mode

Time for action – creating a new database and adding sample data

Time for action – shutting down RavenDB

Summary

Chapter 2: RavenDB Management Studio

Introducing the RavenDB Management Studio

Management Studio's multi-databases feature

Time for action – creating a new database

Management Studio's Documents screen

Time for action – creating your first document

Time for action – loading a document

Time for action – searching for a document

Time for action – exporting documents to a CSV file

Time for action – adding a custom metadata key

Management Studio's Collections screen

Time for action – modifying a document

Management Studio's Indexes screen

Time for action – creating an Index

Time for action – querying an Index

Time for action – editing an Index

Time for action – querying an Index

Time for action – creating a Dynamic Query

Management Studio's Patch screen

Time for action – patching a document

Management Studio's Tasks screen

Time for action – importing external data using a CSV file

Management Studio's Alerts screen

Management Studio's Logs screen

Time for action – exploring the Logs screen

Viewing the database settings

Time for action – viewing the database's active bundles

Time for action – opening the System database's Settings page

Bundles

Time for action – enabling the Periodic Backup feature

Doing more with the Management Studio

Time for action – customizing the columns

Time for action – copying the data document to the clipboard

Time for action – deleting a database using the Management Studio

Summary

Chapter 3: RavenDB.NET Client API

The RavenDB .NET Client API

Setting up your development environment

Time for action – installing NuGet Package Manager

Creating a simple application

Time for action – adding RavenDB Client to a Visual Studio project

Connecting to RavenDB

Time for action – connecting to RavenDB

Loading a document

Time for action – loading a document

Inserting a new Document

Time for action – inserting a new document

Updating a document

Time for action – updating a document

Deleting a document

Time for action – deleting a document

Querying a documents collection

Time for action – querying a documents collection

Summary

Chapter 4: RavenDB Indexes and Queries

The RavenDB indexes

RavenDB Map/Reduce implementation

RavenDB dynamic indexes

Time for action – querying a dynamic index

Time for action – querying a temporary index

Time for action – managing temporary indexes

RavenDB static indexes

Time for action – defining a Map function for an index

Time for action – adding a Reduce function to an index

Time for action – adding a TransformResults to the index

RavenDB stale indexes

Time for action – checking for stale index results

Time for action – explicitly waiting for a non-stale index result

Summary

Chapter 5: Advanced RavenDB Indexes and Queries

The RavenDB AbstractIndexCreationTask class

Creating indexes using the AbstractIndexCreationTask class

Time for action – creating indexes using AbstractIndexCreationTask class

Time for action – creating indexes using the ResultReduce class

Time for action – using the TransformResults function

Creating multimap indexes

Time for action – creating multimap indexes

Full-text and exact matching search

Time for action – creating a full-text searching index

Time for action – creating multifields searching index

Time for action – using a custom analyzer

Paging a query's results

Time for action – paging a query's results

Summary

Chapter 6: Advanced RavenDB Document Capabilities

RavenDB attachments

Time for action – using attachments to store images

Time for action – retrieving stored attachments

Time for action – retrieving and updating anattachment's metadata

Handling documents relationships

Time for action – using Include to reduce query calls

Time for action – indexing related documents

Patching documents

Time for action – applying a ScriptedPatchRequest

Time for action – using PatchRequest to add a new field to a document

Summary

Chapter 7: RavenDB Administration

RavenDB configuration options

Time for action – optimizing RavenDB performances

Backing up RavenDB databases

Time for action – backing up the World database

Time for action – backing up the World database using Management Studio

Restoring RavenDB databases

Time for action – restoring the World database using the command line

Time for action – restoring the World database using Management Studio

Exporting and importing RavenDB databases

Time for action – exporting the World database using Smuggler

Time for action – importing the World database using Smuggler

RavenDB server bundles

Time for action – creating a master to slave database replication

Time for action – replicating to Microsoft SQL Express

Time for action – authenticating and authorizing

Enabling RavenDB logging

Time for action – enabling RavenDB logging

Upgrading the RavenDB server

Time for action – upgrading the RavenDB server

Summary

Chapter 8: Deploying RavenDB

RavenDB deployment strategies

Running RavenDB as a Windows Service

Time for action – running RavenDB as a Windows Service

Time for action – uninstalling the RavenDB service

RavenDB and IIS

Time for action – running RavenDB from an IIS virtual directory

Time for action – running RavenDB as an IIS application

RavenDB Embedded mode

Time for action – running RavenDB in Embedded mode

Time for action – running RavenDB inmemory

Summary

Chapter 9: Scaling-out RavenDB

What is scaling-out?

RavenDB sharding

Time for action – preparing RavenDB for sharding

Time for action – implementing RavenDB sharding (the blind mode)

Time for action – implementing RavenDB sharding (the smart mode)

Mixing sharding and replication

Summary

Chapter 10: RavenDB Profiling

What is profiling?

Time for action – enabling the RavenDB profiler

Time for action – running the RavenDB visual host

RavenDB workload simulator/stress tests

Summary

Chapter 11: RavenDB HTTP API

The RavenDB HTTP API

Understanding REST

Anatomy of the RavenDB REST request URL

The RESTClient tool

Time for action – downloading and launching the RESTClient tool

The GET request

Time for action – performing a GET request

The PUT request

Time for action – granting access to perform a PUT request

Time for action – performing a PUT request

The POST request

Time for action – performing a POST request

The PATCH request

Time for action – performing a Patch request

The DELETE request

Time for action – performing a Delete request

Getting multiple documents with a single request

Time for action – getting multiple documents within a single request

Querying an Index

Time for action – querying an Index

Summary

Chapter 12: Putting It All Together

A word about ASP.NET MVC

Application architecture key concepts

Creating an ASP.NET MVC 4 project with RavenDB

Time for action – creating the World ASP.NET MVC application

Time for action – adding the World application's Models

Time for action – adding the Controllers

Time for action – adding the Views

Time for action – launching the World application

Doing more with the World application

Time for action – creating indexes automatically

Time for action – the paging query <Country>() result

Time for action – creating the Country master/details View

Time for action – implementing the Search view

Summary

Chapter 13: Pop Quiz Answers

Chapter 3, RavenDB.NET Client API

Chapter 4, RavenDB Indexes and Queries

Chapter 5, Advanced RavenDB Indexes and Queries

Chapter 7, RavenDB Administration

Chapter 9, Scaling-out RavenDB

Chapter 11, RavenDB HTTP API

What You Will Learn

Get RavenDB up and running on your local machine or server, and discover the RavenDB Management Studio

Host RavenDB within IIS and run it as a Windows service or in embedded mode

Secure RavenDB using a replication bundle and optimize it with sharding

Authors

Khaled Tannir

Khaled Tannir has been working with computers since 1980. He began programming with the legendary Sinclair Zx81 and later with Commodore home computer products (Vic 20, Commodore 64, Commodore 128D, and Amiga 500).
He has a Bachelor's degree in Electronics, a Master's degree in System Information Architectures, in which he graduated with a professional thesis, and completed his education with a Master of Research degree.
He is a Microsoft Certified Solution Developer (MCSD) and has more than 20 years of technical experience leading the development and implementation of software solutions and giving technical presentations. He now works as an independent IT consultant and has worked as an infrastructure engineer, senior developer, and enterprise/solution architect for many companies in France and Canada.
With significant experience in Microsoft .Net, Microsoft Server Systems, and Oracle Java technologies, he has extensive skills in online/offline applications design, system conversions, and multilingual applications in both domains: Internet and Desktops.
He is always researching new technologies, learning about them, and looking for new adventures in France, North America, and the Middle-east. He owns an IT and electronics laboratory with many servers, monitors, open electronic boards such as Arduino, Netduino, RaspBerry Pi, and .Net Gadgeteer, and some smartphone devices based on Windows Phone, Android, and iOS operating systems.
In 2012, he contributed to the EGC 2012 (International Complex Data Mining forum at Bordeaux University, France) and presented, in a workshop session, his work on "how to optimize data distribution in a cloud computing environment". This work aims to define an approach to optimize the use of data mining algorithms such as k-means and Apriori in a cloud computing environment.
He is the author of RavenDB 2.x Beginner's Guide, Packt Publishing.
He aims to get a PhD in Cloud Computing and Big Data and wants to learn more and more about these technologies.
He enjoys taking landscape and night time photos, travelling, playing video games, creating funny electronic gadgets with Arduino/.Net Gadgeteer, and of course, spending time with his wife and family.
You can reach him at contact@khaledtannir.net.

Table of Contents

Chapter 1: Getting Started with RavenDB

Understanding the basics of NoSQL Databases

What is RavenDB?

From relational databases to RavenDB

Why RavenDB?

How RavenDB works?

Anatomy of a Document

The JSON format

Downloading and installing RavenDB

Time for action – downloading and installing RavenDB

Running RavenDB server in the Console mode

Time for action – exploring the Start.cmd file

Time for action – launching RavenDB in the Console mode

Time for action – creating a new database and adding sample data

Time for action – shutting down RavenDB

Summary

Chapter 2: RavenDB Management Studio

Introducing the RavenDB Management Studio

Management Studio's multi-databases feature

Time for action – creating a new database

Management Studio's Documents screen

Time for action – creating your first document

Time for action – loading a document

Time for action – searching for a document

Time for action – exporting documents to a CSV file

Time for action – adding a custom metadata key

Management Studio's Collections screen

Time for action – modifying a document

Management Studio's Indexes screen

Time for action – creating an Index

Time for action – querying an Index

Time for action – editing an Index

Time for action – querying an Index

Time for action – creating a Dynamic Query

Management Studio's Patch screen

Time for action – patching a document

Management Studio's Tasks screen

Time for action – importing external data using a CSV file

Management Studio's Alerts screen

Management Studio's Logs screen

Time for action – exploring the Logs screen

Viewing the database settings

Time for action – viewing the database's active bundles

Time for action – opening the System database's Settings page

Bundles

Time for action – enabling the Periodic Backup feature

Doing more with the Management Studio

Time for action – customizing the columns

Time for action – copying the data document to the clipboard

Time for action – deleting a database using the Management Studio

Summary

Chapter 3: RavenDB.NET Client API

The RavenDB .NET Client API

Setting up your development environment

Time for action – installing NuGet Package Manager

Creating a simple application

Time for action – adding RavenDB Client to a Visual Studio project

Connecting to RavenDB

Time for action – connecting to RavenDB

Loading a document

Time for action – loading a document

Inserting a new Document

Time for action – inserting a new document

Updating a document

Time for action – updating a document

Deleting a document

Time for action – deleting a document

Querying a documents collection

Time for action – querying a documents collection

Summary

Chapter 4: RavenDB Indexes and Queries

The RavenDB indexes

RavenDB Map/Reduce implementation

RavenDB dynamic indexes

Time for action – querying a dynamic index

Time for action – querying a temporary index

Time for action – managing temporary indexes

RavenDB static indexes

Time for action – defining a Map function for an index

Time for action – adding a Reduce function to an index

Time for action – adding a TransformResults to the index

RavenDB stale indexes

Time for action – checking for stale index results

Time for action – explicitly waiting for a non-stale index result

Summary

Chapter 5: Advanced RavenDB Indexes and Queries

The RavenDB AbstractIndexCreationTask class

Creating indexes using the AbstractIndexCreationTask class

Time for action – creating indexes using AbstractIndexCreationTask class

Time for action – creating indexes using the ResultReduce class

Time for action – using the TransformResults function

Creating multimap indexes

Time for action – creating multimap indexes

Full-text and exact matching search

Time for action – creating a full-text searching index

Time for action – creating multifields searching index

Time for action – using a custom analyzer

Paging a query's results

Time for action – paging a query's results

Summary

Chapter 6: Advanced RavenDB Document Capabilities

RavenDB attachments

Time for action – using attachments to store images

Time for action – retrieving stored attachments

Time for action – retrieving and updating anattachment's metadata

Handling documents relationships

Time for action – using Include to reduce query calls

Time for action – indexing related documents

Patching documents

Time for action – applying a ScriptedPatchRequest

Time for action – using PatchRequest to add a new field to a document

Summary

Chapter 7: RavenDB Administration

RavenDB configuration options

Time for action – optimizing RavenDB performances

Backing up RavenDB databases

Time for action – backing up the World database

Time for action – backing up the World database using Management Studio

Restoring RavenDB databases

Time for action – restoring the World database using the command line

Time for action – restoring the World database using Management Studio

Alerts & Offers

Series & Level

We understand your time is important. Uniquely amongst the major publishers, we seek to develop and publish the broadest range of learning and information products on each technology. Every Packt product delivers a specific learning pathway, broadly defined by the Series type. This structured approach enables you to select the pathway which best suits your knowledge level, learning style and task objectives.

Learning

As a new user, these step-by-step tutorial guides will give you all the practical skills necessary to become competent and efficient.

Beginner's Guide

Friendly, informal tutorials that provide a practical introduction using examples, activities, and challenges.

Essentials

Fast paced, concentrated introductions showing the quickest way to put the tool to work in the real world.

Cookbook

A collection of practical self-contained recipes that all users of the technology will find useful for building more powerful and reliable systems.

Blueprints

Guides you through the most common types of project you'll encounter, giving you end-to-end guidance on how to build your specific solution quickly and reliably.

Mastering

Take your skills to the next level with advanced tutorials that will give you confidence to master the tool's most powerful features.

Starting

Accessible to readers adopting the topic, these titles get you into the tool or technology so that you can become an effective user.

Progressing

Building on core skills you already have, these titles share solutions and expertise so you become a highly productive power user.