Reader small image

You're reading from  RavenDB 2.x Beginner's Guide

Product typeBook
Published inSep 2013
PublisherPackt
ISBN-139781783283798
Edition1st Edition
Right arrow
Author (1)
Khaled Tannir
Khaled Tannir
author image
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.
Read more about Khaled Tannir

Right arrow

Chapter 2. RavenDB Management Studio

The RavenDB Management Studio is a graphical integrated environment for accessing, configuring, managing, and administering the RavenDB server. It embeds a group of rich editors and viewers which are easy to use and very helpful to developers and administrators of all skill levels.

In this chapter, you will learn to use the RavenDB Management Studio to create or edit Documents and Collections, to create Indexes, or to view logs and other useful features of the Management Studio.

In this chapter we will cover:

  • The Management Studio's main interface

  • Viewing and managing Documents, Collections, and Indexes

  • Patching documents using the Management Studio

  • Importing/exporting data using the Management Studio

Introducing the RavenDB Management Studio


The RavenDB Management Studio that comes with RavenDB is a Silverlight based application which is used to manage the RavenDB server. It is a very useful tool to look at the server databases and the activity logs to understand what's going on at the server-side. With the Management Studio, we can create new databases and new documents; we can modify data directly if we need to. Also, when using RavenDB, this will be very handy in debugging and application development.

The main Management Studio user interface has a few different tabs on the top: Documents, Collections, Indexes, Patch, Alerts, and Logs. We can use these tabs to access the different screens and manage different parts of the database server. There is a New button list; by clicking on the arrow of the New button, there are several options shown such as: create a new Document, create a new Index, or create a new Dynamic Query. On selecting and clicking on one of these options, the respective...

Management Studio's multi-databases feature


RavenDB supports multi-databases, the Management Studio provides an easy way to create and manage new and multiple databases from the same user interface. On the left-side of the Management Studio, the toolbar shows a hyperlink button with the name of the current database we are working with. This hyperlink button is used to display the Databases screen and show the list of all the other available databases. You can shift the current database by selecting a new one from the list of available databases.

Also, we have the Settings button (the cogwheel button) which allows us to set common options for all databases and specific bundle (which is the RavenDB extensions) options.

Creating a new database

When the Management Studio is started up, it shows the Databases screen and displays the list of all hosted databases. Each database in the list is displayed in a rectangle with the number of documents that this database has. On selecting a database from...

Time for action – creating a new database


To begin using the Management Studio, we need to create a new database and populate it with the sample data. In this section, you will learn to create a new database using the Management Studio wizard form.

  1. Launch the RavenDB server using the Start.cmd command file.

  2. In the Management Studio, click on the Databases link.

  3. Click on the New Database button to open the Create a New Database wizard form.

  4. Enter Orders for the Name of new database and click on the Next button to create the new database.

What just happened?

We just created a new database named Orders using the Create a New Database wizard of the Management Studio.

In steps 1 to 3, we launched the RavenDB server and opened the Create a New Database wizard to create the new database.

After clicking on the Next button, the Orders database is created. It will become the current database and will be added to the hosted databases list.

Note

If the server has no hosted database, yet the Create a New Database...

Management Studio's Documents screen


The Documents screen shows a list of all documents from different collections in the RavenDB server instance. Documents from different collections are striped with different colors. Within the Documents screen, you can display documents in different view modes; there are six different view modes which you can switch between. Each view mode defines the size of the document preview in the listing:

  • Details: This view will display document's data in rows and document's fields in columns.

  • ID Only: This view will display only the document ID. This view mode is useful for low bandwidth connections.

  • Small Card, Medium Card, Large Card: Each of these modes will display documents as cards in a different size. You can choose the size of the card to display in order to show more or less cards on a single page.

  • Extra Large Card: This view will show the whole data of the document as a JSON string.

The default view mode, when the Management Studio starts up, is the...

Time for action – creating your first document


You will learn to create some new documents using the Management Studio and add them to the Orders database.

  1. If it is not running, launch the RavenDB server.

    Tip

    To open the Management Studio manually in your browser, go to this URL: http://localhost:8080/raven/studio.html.

  2. Ensure that the current database is Orders, otherwise, click on the Databases hyperlink button to display the Databases screen and select the Orders database.

  3. In the Management Studio toolbar, click on the arrow near the New button and select New Document.

  4. Enter the document ID Orders/A179854 and enter the following document data values:

    {
    "CustomerId":"A54309",
    "Item":"Paper Set",
    "OrderDate":"11/17/2011",
    "UnitCost":25.99,
    "Units":5
    }
  5. After that, click on the Save button to insert the document into the Orders database.

  6. Repeat the steps 3 and 4 to add new documents to the Orders database using the following data:

Time for action – loading a document


You will use the Management Studio to load a document from the Orders database to view it and modify some values.

  1. Select the Orders database from the Databases screen to activate it and make it the current database.

  2. Select the Documents tab screen to display the documents list.

  3. Click on the Switch between views button and select the ID Only view mode.

  4. Select the document with the ID = Orders/B765760 and click on the pencil icon in the bottom-right corner to open the document in the edit screen.

    Tip

    In the Details view mode, you might double-click on the row that represents the document to open it in the edit screen mode.

  5. Change the Units field value to be 20.

  6. Click on the Save button to make the changes permanent.

What just happened?

We learned how to load the document with the ID Orders/B765760 from the Orders database in the edit screen mode and change its Units value directly in the Management Studio.

In steps 1 to 3, we used the pencil icon to open the document...

Time for action – searching for a document


You will use the Management Studio to search the document with the ID Orders/A154230 in the Orders database to view it or to edit it.

  1. In the Management Studio, click on the Go To Document search box.

  2. Search for the document with the ID Orders/A154230 (which belongs to the Orders database).

  3. Press Enter to validate your typing and then the whole document data is loaded in the edit screen.

What just happened?

We used the Management Studio's Go To Document search box to load the document with the ID= Orders/A154230 in the edit mode.

In case that the document you are looking for does not exist in the database, you will be redirected to the Documents tab, otherwise, the Document edit page will load with the requested document.

Note that while typing suggestions will appear for you.

Exporting a database to a CSV file

In order to use your documents outside RavenDB, you can convert a RavenDB database document to a comma-separated values (CSV) text file by using...

Time for action – exporting documents to a CSV file


You will use the Management Studio to export the Orders database documents to a CSV file.

  1. In the Management Studio, select the Document tab screen.

  2. Click on the Switch between views button and select the Details view mode.

  3. Click on the Export to CSV button to export the database documents to a CSV text file format.

  4. Click on the OK button of the security warning dialog box to confirm the database documents export.

  5. Choose a filename and folder and click on the Save button to save the exported file.

What just happened?

We learned how to export all documents of the Orders database to a CSV file.

In steps 1 and 2, we opened the Management Studio and displayed the Documents screen. Then switched to the Details view mode to show the Export to CSV button.

Note

The Export to CSV button will only appear if you are in the Details view mode.

In steps 3 to 5, we exported all documents of the Orders database to a CSV text file format and saved it on the computer...

Time for action – adding a custom metadata key


You will open a document from the Orders database in the Management Studio, add a new metadata key, and set its value.

  1. In the Management Studio, open the Document screen.

  2. Double-click on the document with the ID = Orders/B765760 (chosen arbitrary) to open it in the edit mode.

  3. Click on the Metadata tab to display metadata related to the document.

  4. Add a new custom metadata key-value, Developer-Name, and set its value to Khaled.

  5. Click on the Save button to make the changes permanent.

What just happened

You just loaded a document and added a new custom metadata key.

Metadata are key-value pairs and are stored using the JSON format. Each document may have more than one metadata. The metadata document begins with { (left brace) and ends with } (right brace).

Each key is followed by : (colon) and the key-value pairs are separated by , (comma).

So the Developer-Name represents the key name and Khaled represents the value assigned to that key name.

Note that...

Management Studio's Collections screen


In RavenDB documents are stored in Collections. A Collection is a simple logical way to group related documents together and should not be considered as a "database table". Usually, Collections are used to group together documents that have a similar structure, but this is not a compulsion. From the database standpoint, a Collection is just a group of documents that share the same entity name.

The Collections screen shows a list of all available collections in the database and the documents associated with them. In the Collections tab screen, we can see different types of Collections and we see all documents that are related to the selected collection. The documents are loaded from the database and displayed by newest first. The documents from different collections are striped with different colors.

Within the Collections screen, a document can be edited directly in the Management Studio. To get the document in the editing screen, you can simply double...

Time for action – modifying a document


You will explore and learn to modify a document displayed within the Management Studio's Collections screen.

  1. In the Management Studio, select the Collections tab to display the Collections screen.

    In the Collections screen section, we can see that we have one collection named Orders which contains five documents.

    Under the Documents screen section, we see all documents related to the Orders collection which is the active selection in the Collections section.

  2. Choose the ID Only view mode to display only the ID of each document in the Documents screen section. (The Switch between views button is located on the top-right corner of the Documents screen section).

    Note

    There are six different view modes we can switch between: Details, ID Only, Small Card, Medium Card, Large Card, and Extra Large Card.

  3. Select the document with the ID = Orders/B768920 from the Documents screen section and click on the pencil icon on the bottom-right corner to open it in the edit...

Management Studio's Indexes screen


The Management Studio's Indexes screen displays a list of all the available indexes in the database.

An Index in RavenDB is a map or map and/or reduce/transform query written in LINQ. The Mapping expression gathers the set of data to query. The Reduction function (which is optional) will "reduce" the map by a set of criteria or transformations. Think of map simply as the selector for all the data that your query cares about. The reduce expression is then performed on the map data to group or summarize it.

In RavenDB, Indexes might have one or more map function; the Reduce function is not required but an Index might have only one Reduce function. When using the RavenDB 2.0, only one Transform function is permitted and more than one in RavenDB 2.5.

Note

RavenDB Indexes, Map/Reduce/Transform, will be discussed in detail in Chapter 5, Advanced RavenDB Indexes and Queries.

The general idea is that we create a LINQ query that returns the data elements that should...

Time for action – creating an Index


You will create your first Index using the Management Studio's Indexes screen.

  1. In the Management Studio, select the Indexes tab and click on it to display the Indexes screen.

  2. Click on the New Index button in the toolbar to open the Edit Index screen.

  3. Name the new index TotalOrdersPerCustomer.

  4. In the Maps section, enter the following code snippet:

    from order in docs.Orders
    select new {CustomerId = order.CustomerId,TotalCost = order.Units * order.UnitCost}
  5. Click on the Save Index button to save the index which will appear in the available indexes list.

    Note

    The Management Studio will not save the index if it detects an error in the LINQ query.

  6. Click on the Indexes link to return to the Indexes screen.

What just happened?

We created our first index named TotalOrdersPerCustomer using the Management Studio. This index contains, for now, a single Map function which is a LINQ query that returns a two-column dataset, one of which is a calculated column.

The first column...

Time for action – querying an Index


We will learn to query the TotalOrdersPerCustomer index we have created in the previous section and visualize the query result.

  1. In the Management Studio, select the Indexes tab and click on it to display the Indexes screen.

  2. Click on the TotalOrdersPerCustomer index from the indexes list in order to execute the index and display its result in the Query Index screen.

  3. In the Query Index screen, click on the Query Options button and check the Index Entries to show the index entries instead of the matching documents.

What just happened?

We just queried the TotalOrdersPerCustomer index and modified queries display options to customize the result display. We did this in order to show the index entries instead of the matching documents.

At the bottom of the Results section, there are displayed some statistics and metadata about the query that just has been executed.

Editing an Index

Editing an index in the Management Studio means to bring up the C# code of the Map/Reduce...

Time for action – editing an Index


We want to enhance the TotalOrdersPerCustomer index by adding a Reduce function. For that, we will open the index in the Edit Index screen and modify its related LINQ functions.

  1. In the Management Studio, display the Indexes screen.

  2. Click on the pencil at the right of the name of the TotalOrdersPerCustomer index.

  3. In the Edit Index screen, click on the Add Reduce button to add a new Reduce function

  4. In the Reduce section, enter the following code snippet:

    from result in results
    group result by result.CustomerId into g
    select new {CustomerId = g.Key, TotalCost = g.Sum(x=>x.TotalCost)}
  5. Click on the Save Index button to save changes.

  6. Click on the Indexes links to show the Indexes list.

  7. Click on the TotalOrdersPerCustomer index to query it and display results in the Query Index Screen.

What just happened?

We enhanced the TotalOrdersPerCustomer index and added a Reduce function.

This Reduce LINQ function aggregates the result of the Map function (written in the previous...

Time for action – querying an Index


We will query the TotalOrdersPerCustomer index and will apply a query expression to filter the index result using the Lucene syntax query.

  1. In the Management Studio, select the Indexes tab to display the Indexes screen.

  2. Click on the TotalOrdersPerCustomer index to query it and display results in the Query Index Screen.

  3. In the Query area, enter the following code snippet:

    CustomerId: A54309

    Tip

    In the Query area, press Ctrl + Space to show the index fields list and select the CustomerId field.

  4. Click on the Execute button to show the results of the query.

What just happened?

We queried the TotalOrdersPerCustomer index and filtered the query result.

Once the result was displayed, we wrote a Lucene query expression to filter that result and display all documents which matched the CustomerID = A54309.

The query engine will search index result documents collection in the CustomerId field matching the value we have specified. Think of it as the "where" clause parameter...

Time for action – creating a Dynamic Query


You will learn to create a dynamic query using the Lucene syntax and promote the related temporary index to permanent.

  1. In the Management Studio, select the Indexes tab to display the Indexes screen.

  2. Click on the Dynamic Query button to display the Query Index screen.

  3. Click on the Dynamic/ list and select the Orders collection.

  4. In the Query area, enter the following code snippet:

    UnitCost: [1 TO 20]

    Tip

    In the Query area, press Ctrl + Space to show the index fields list and select the UnitCost field.

    To do search on the data, instead of a lexical search you can use Unitcost: [Dx1 TO Dx20].

  5. Click on the Execute button to show the results of the query.

  6. Click on the Indexes link to show the Indexes screen.

  7. Right-click on the Auto/Orders/ByUnitCost index to show the contextual menu and click on the Promote to auto index button.

What just happened?

We created a dynamic query which will retrieve all the documents in the Orders collection that matches the range values...

Management Studio's Patch screen


In a document oriented database, the server itself can operate with the document and not just the client. It is also possible to directly edit the data in the document on the server-side. This action in RavenDB context is called patching. With the Management Studio, you can choose to patch a Document, a Collection, or an Index using the JavaScript.

The Management Studio's Patch screen has two main areas. The first area is reserved to the Patch Script and Parameters and the second area is used to visualizing the state of a document before patching and how it will looks like after patching. This is useful because you can validate the patching script before applying it.

Note

RavenDB's patching will be discussed with more detail in Chapter 6, Advanced RavenDB Documents Capabilities.

Time for action – patching a document


You will learn how to patch the document with the ID Orders/A655302 using a patching script that combines the JavaScript and parameters.

  1. In the Management Studio, select the Orders database to be the current database and click on the Patch tab to show the Patch screen.

  2. In the Patch type list, select the Document type.

  3. In the Document to patch textbox, enter Orders/A655302, which is the ID of the document we want to patch, and press Enter.

  4. Click on the Add new Parameter button (the green plus sign to the right of the Parameters section) to add a new parameter.

  5. Enter ItemName for the Name and Ink Pen for the Value.

  6. In the Patch Scripts zone, enter the following JavaScript code snippet:

    this.UnitCost = this.UnitCost * 1.15
    this.Item = ItemName
  7. Click on the Test button to test the patch script on the selected document.

  8. Observe the changes in the After Patch section and verify that the document has new fields value.

  9. Click on the Patch button to execute the patch scripts...

Management Studio's Tasks screen


The Management Studio's Tasks screen is designed to allow you to perform common administrative tasks for RavenDB databases. Within the Management Studio's Tasks screen, you can basically import and export databases between the RavenDB servers. Each database may be exported as a dump file that has a .ravendump extension. On the other hand, you can also use this dump file to import a database into RavenDB.

Also, within the Tasks screen, you can create a backup of your database and enable or disable background indexing tasks. This is used basically by developers for debugging purpose and requires database administrator privileges.

You may need to import your data into RavenDB using a CSV file, this task is performed by the CSV Import feature. Note that if the imported file contains Unicode characters, it should be encoded using UTF-8.

Also, within the Tasks screen, you can insert sample data into your database and populate it for learning or testing purposes (a...

Time for action – importing external data using a CSV file


You will create a new database called World and populate it with external data which you will import using a CSV text file.

  1. In the Management Studio, click on the Databases link to show the Database screen.

  2. Click on the New Database button to open the Create New Database wizard form, then create a new database named World.

  3. Click on the Tasks tab to show the Tasks screen.

  4. Click on the CSV Import toolbar button, this will show the CSV Import screen which contains a CSV Import button.

  5. Click on the CSV Import button and select the Cities.csv file (which is a part of the book companion package files).

  6. Click on the Documents tab or the Collections tab to verify that the database has been populated with new 3051 documents.

What just happened?

We just created a new database named World. Then using the Import CSV feature, we imported the Cities.csv file and populated the database we just created.

Note

The World database will be used and enhanced...

Management Studio's Alerts screen


The Management Studio's Alerts screen is helpful to see the alerts sent from the RavenDB server. At the time of writing this book, in the RavenDB v2.0.0 Build 2372 only errors in periodic backups will send alerts. If you need to track a specific alert sent by the RavenDB server, you may choose it in the table and mark it as Observed and make it Unobserved when there is no more need to track it.

You may use the Alerts screen's toolbar buttons to perform these actions:

  • Hide/Show Observed: This button will toggle on mouse click between Show Observed and Hide Observed, this will determine whether the observed alerts will be shown or not.

  • Mark as Observed: This button will mark all the current alerts as Observed.

  • Mark as Unobserved: This button will mark all the current alerts as Unobserved.

  • Delete All Observed: This button will remove all the observed items from the list.

  • Refresh from server: This button will refresh the alerts table from database. All the changes...

Management Studio's Logs screen


RavenDB activity logs can be viewed using the Management Studio's Logs screen. The logs journal is limited to the last 500 entries. You can use the filter button on the top-right corner of the Management Studio's user interface and choose to display all tracked events or just the error events entries. When selecting an item in the event logs table, you can see the details of that item in the bottom below the event logs table.

Time for action – exploring the Logs screen


You will learn to explore the Management Studio's Logs screen.

  1. In the Management Studio, click on the Logs tab to show the Logs screen.

  2. Click on the All Logs button to display all the tracked events or click on the Errors Only button to show only the error events.

  3. Click on any entry in the logs table to view its details in the bottom section.

What just happened?

In steps 1 and 2, we opened the Management Studio and displayed the Logs screen.

In step 3, we select a log entry in the logs table and display its details.

Viewing the database settings


The Management Studio provides a complete set of administrative tools that let users fully administer their system and manage all the users and objects in a database. Each RavenDB database has a Document database that represents the database. In the Database Settings page, you can edit the common databases settings and other options are dependent on the bundles selected for this database.

Time for action – viewing the database's active bundles


We will take a look at the World database's Settings page.

  1. In the Management Studio, click on the Databases link to display the Databases screen.

  2. Select the World database and right-click on it to show the contextual menu, then choose Edit Settings.

    Tip

    The Edit Database Settings button (the cogwheel button) opens the Settings page for the current database.

What just happened?

We just opened the Settings screen for the World database and viewed its content.

You can see the different setting parameters as the database folder and active bundles for the database.

When creating a new database, the PeriodicBackup bundle is activated by default for the new database. The Raven/ActiveBundles metadata key indicates the list of all the activated bundles when the database is created. In this case we did not activate any other bundles.

The System database settings

The settings for the System database are different from the other databases. It is possible...

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


You will open the RavenDB's System database in the edit mode.

  1. In the Management Studio, click on the Databases link to display the Databases screen.

  2. Click on the System Databases button to show the System database documents.

  3. Click on the OK button of the warning window message to confirm the action.

  4. Click on the Edit Database Settings button (the cogwheel button) to show the System Database Settings screen.

What just happened?

We just opened the Databases screen to show the System database, then show the System Database Settings screen.

The API keys are used when trying to authorize user and has set its privileged access to the database using the OAuth protocol, which is an open protocol to allow secure authorization in a simple and standard method from web, mobile, and desktop applications.

Windows Authentication is the process of determining the identity of a user based on the user's credentials. The user's credentials are usually...

Bundles


RavenDB database supports extensibility and new features can be implemented by a user to meet their needs, if it has not been already implemented by RavenDB. This is where Bundles come in. Installing a Bundle is very easy and it is done by dropping the Bundle's files into the \Plugins directory of the RavenDB installation, which is the default path. The path to the Plugins folder is configurable and can be changed to another location by changing the Raven/PluginsDirectory configuration parameter.

You may choose to activate one or more Bundle a when you create a database. You will have to then set up most of the Bundles within the database creation process and they cannot be removed or added afterwards. So, Bundle's strategy has to be considered carefully and adding/removing Bundles is something that can safely happen only when the database is created and does not contain any documents. Usually, Bundles are added within the database creation process and then you configure their behavior...

Time for action – enabling the Periodic Backup feature


You will learn to enable or disable the Periodic Backup Bundle which is added by default to each new database.

  1. In the Management Studio, click on the Databases link to display the Databases screen.

  2. Select the World database and right-click on it to show the contextual menu, then choose Edit Settings.

  3. Select Periodic Backup from the list on the left-side to show its settings page and then click on Activate Periodic Backup to activate the Bundle.

  4. Enter C:\WorldBackup as the path where database backups will be stored.

  5. Enter 60 minutes for the backup interval.

  6. Click on the Save Changes button to save the new parameters.

What just happened?

We learned how to activate the Periodic Backups Bundle for the World database.

In steps 1 to 4, we activated the Periodic Backups Bundle for the World database and in steps 5 and 6, we entered the backup path C:\WorldBackup with the backup interval of 60 minutes. RavenDB will use this information to make a backup...

Doing more with the Management Studio


The RavenDB Management Studio is a great tool with almost everything you need right at your fingertips. Beyond displaying documents, collections, and indexes, it allows you to manage them. You can delete a document, a collection, an index, or copy data to and from the clipboard. Also, you can customize your views by choosing the columns you want to display.

Choosing the columns

Columns are a part of the Management Studio's Documents screen which is used to display database documents in the Details view mode. You may be familiar with this view type in your Documents screen. The Management Studio allows you to add or remove columns to further customize your views (columns are also referred to as fields).

Columns can be bound to properties just like you would in code or a particular item in an array (using an index and square brackets). Also, you can bind column to a document metadata or bind directly to the JSON Document object using an XAML binding syntax...

Time for action – customizing the columns


You will customize the Documents screen and choose columns to display.

  1. In the Management Studio's Databases screen, select the Sales database (created in Chapter 1, Getting Started with RavenDB) and activate it as the current database.

  2. Click on the Documents tab to display the Documents screen.

  3. Use the Switch between views button to select the Details view mode.

  4. Right-click on any column header to display the contextual menu and click on Choose Columns.

  5. In the Choose Columns window, select Custom.

  6. Use Move Selected Column (up or down) to move the AlbumArtUrl column to be the latest column.

  7. Double-click on the [New-Column] to add a new column.

  8. Enter Artist.Name in the Binding column and Artist Name in the Title column.

    Note

    Note that while typing, suggestions are displayed.

  9. Use Move Selected Column to move up the Artist Name column to be the third column.

  10. Click on the OK button to apply changes and return to the Documents screen.

What just happened?

We just...

Time for action – copying the data document to the clipboard


We will take a look at how to utilize the Copy Document(s) to Clipboard feature of the Management Studio.

  1. In the Management Studio, click on the Databases link to display the Databases screen.

  2. Select the Sales database and then click on the Documents tab to display the Documents screen. (You can also select the Collections tab and display the Collections screen.)

  3. Select a document in the list and right-click on it to show the contextual menu and select Copy Document(s) to Clipboard. You may need to select multiple documents from the documents list; to do so you can group documents using the Shift or the Ctrl key.

  4. Open the Notepad application (or your favorite text editor).

  5. Press Ctrl + V to paste the document data in the Notepad and view it.

What just happened?

In steps 1 to 5, we copy the data of one document from the Sales database using copy to clipboard Management Studio's feature and paste it in the Notepad application.

Deleting...

Time for action – deleting a database using the Management Studio


You will learn how to delete a database from RavenDB using the Delete action from the contextual menu in the Databases screen.

  1. In the Management Studio, click on the Databases link to display the Databases screen.

  2. Select the Sales database and right-click on it to display the contextual menu and click on Delete.

  3. Check the option case Physically delete all database data to delete all the database data and its folders.

    Tip

    By clicking on the Export button, you can export the database documents before deleting it.

What just happened?

In steps 1 and 2, we selected in the Management Studio the Sales database in order to delete it.

In step 3, we deleted the database and all its related files and folders.

By checking the option Physically delete all database data, RavenDB will delete all database data and folders containing the database and all its related information, such as logs and indexes, from your computer. Otherwise, the files will...

Summary


We learned a lot in this chapter about the RavenDB's Management Studio and its features.

Specifically, we covered the main graphical user interface of the Management Studio and each tab in detail.

We learned how to launch the Management Studio, how to create and select databases from the Databases screen.

From the Documents screen, we learned how to create, view, edit, search documents, and took a look at the RavenDB document metadata. Also, we covered how to view collections within the Collections screen.

We covered the Management Studio's Indexes screen and how to create, execute, view, and edit Indexes. Also, we covered the Query Index screen and how to create Dynamic Queries.

We learned how to patch documents or collections using the Management Studio's Patch screen.

From the Management Studio's Tasks screen, we learned how to import external data using the CSV text files and we took a look to the Alerts screen, the Logs screen, viewing and editing the Database Settings and the particular...

lock icon
The rest of the chapter is locked
You have been reading a chapter from
RavenDB 2.x Beginner's Guide
Published in: Sep 2013Publisher: PacktISBN-13: 9781783283798
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Author (1)

author image
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.
Read more about Khaled Tannir

Id

CustomerId

Item

OrderDate

UnitCost

Units

Orders/A655302

...