
Preface
RavenDB is an open source second generation NoSQL
document database written in .NET. With its schema-less and flexible data model, it is designed to meet the real-world applications and allow you to build high-performance applications quickly and efficiently.
RavenDB 2.x Beginner's Guide introduces RavenDB concepts to the .NET developer who has some background in building desktop and web applications.
This book teaches you everything, right from installing RavenDB to creating documents and querying indexes using the .NET Client API through a series of clear and practical exercises. It starts off with an introduction to RavenDB and its Management Studio before moving on to cover dynamic and static indexes that use Map/Reduce to process datasets. With the help of detailed examples, you will learn how to create, manage, and query these indexes. Also, you will learn how to manage document attachments and patching documents using JavaScript.
With this book, you will learn how to deploy RavenDB in a production environment and how to profile and optimize it to boost performance. You will also learn how to create shards and implement replication to improve data availability and how to interact with RavenDB using the HTTP API.
Finally, you will learn to create an ASP.NET MVC application that uses RavenDB as a baking store to put all learned concepts together.
What this book covers
Chapter 1, Getting Started with RavenDB, introduces the underlying concepts of RavenDB and provides a step-by-step guide on how to install and run a RavenDB server on a computer to create your first RavenDB database.
Chapter 2, RavenDB Management Studio, introduces the RavenDB Silverlight client to let you easily manage documents in RavenDB. You will learn to view, create, edit, or delete documents, as well as how to manage indexes, issue queries, view the errors log, import/export, and so on.
Chapter 3, RavenDB .NET Client API, covers all aspects to interact with RavenDB using the Microsoft .NET framework. You will learn to connect to RavenDB, create, update, and delete documents, and how to query a document collection.
Chapter 4, RavenDB Indexes and Queries, covers RavenDB dynamic, static, and stales indexes. You will learn to create and query RavenDB Map/Reduce indexes and learn to manage temporary indexes.
Chapter 5, Advanced RavenDB Indexes and Queries, introduces the AbstractIndexCreationTask
class and shows you how to use it to create the Map/Reduce indexes. Also, you will learn how to create multi-map indexes, use the TransformResults
function, search over documents, and page query results.
Chapter 6, Advanced RavenDB Document Capabilities, explores the RavenDB document attachments and shows you how to handle document relationships using the Include
statement and how to patch a document or a document collection using JavaScript.
Chapter 7, RavenDB Administration, shows you how to configure, backup, restore, import, and export RavenDB databases. Also, this chapter explores RavenDB bundles and you will learn to implement the SQL replication bundle to replicate data to Microsoft SQL Server.
Chapter 8, Deploying RavenDB, explores the different ways to deploy RavenDB in order to be used in a production or testing environment.
Chapter 9, Scaling-out RavenDB, introduces RavenDB sharding with its two modes: the blind and smart modes. Also, you will learn to mix sharding and replication to shard with dedicated or internal failover nodes.
Chapter 10, RavenDB Profiling, shows you how you can profile RavenDB server in real-time and use this information to optimize and improve the server performance.
Chapter 11, RavenDB HTTP API, shows you how to interact with RavenDB using the RavenDB HTTP API, which follows commonly understood RESTful principles.
Chapter 12, Putting It All Together, uses ASP.NET MVC to build a web application that uses RavenDB as a baking store. This application shows you how to implement a basic RavenDB controller, paging query results, create Master/Detail and Search views, and some other features.
What you need for this book
The following are the prerequisites that you need for this book:
- RavenDB 2.x distribution package, which includes RavenDB Server and Client (http://ravendb.net/download)
- A web browser that supports Microsoft Silverlight 5.0
- Microsoft Visual Studio 2012 (any version) to create, build, and run C# .NET projects (http://www.microsoft.com/en-us/download/details.aspx?id=34673)
- The NuGet Package Manager, included in Visual Studio 2012 (http://visualstudiogallery.msdn.microsoft.com/27077b70-9dad-4c64-adcf-c7cf6bc9970c)
- Chapter 7, RavenDB Administration, requires Microsoft SQL Server Express (included in Visual Studio 2012) to be installed on your machine (http://www.microsoft.com/en-us/download/details.aspx?id=29062)
- Chapter 11, RavenDB HTTP API, requires RESTClient 3.1 or newer (http://www.wiztools.org/)
Who this book is for
This book is great for experienced .NET developers new to document-oriented databases, and who are looking to get a good grounding in how to build applications that take advantage of such NoSQL databases. Having a working knowledge of relational database systems is not needed but will help in grasping some of the concepts quicker.
Conventions
In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.
Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "A Collection
is a logical way of thinking of document groups."
A block of code is set as follows:
{ "CustomerId":"A54309", "Item":"Paper Set", "OrderDate":"11/17/2011", "UnitCost":25.99, "Units":5 }
Any command-line input or output is written as follows:
wbadmin start backup -backupTarget:e: -include:C:\RavenDB-Build-2261\Server\Database\Databases\World
New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "We will open Start.cmd
in the Notepad application to learn how RavenDB will be launched".
Note
Warnings or important notes appear in a box like this.
Tip
Tips and tricks appear like this.
Reader feedback
Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.
To send us general feedback, simply send an e-mail to <feedback@packtpub.com>
, and mention the book title via the subject of your message.
If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.
Customer support
Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.
Downloading the example code
You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.
Errata
Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.
Piracy
Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.
Please contact us at <copyright@packtpub.com>
with a link to the suspected pirated material.
We appreciate your help in protecting our authors, and our ability to bring you valuable content.
Questions
You can contact us at <questions@packtpub.com>
if you are having a problem with any aspect of the book, and we will do our best to address it.