RavenDB 2.x  Beginner's Guide
上QQ阅读APP看书,第一时间看更新

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 throughout the book's chapters.

Have a go hero – exporting documents from different views

Exporting the RavenDB documents to a CSV file is very easy. Depending on the screen you are viewing, you will export different results. Try to export all the documents from each view to a CSV file, where the Export To CSV feature is available (Documents, Collections, and Index Query Results).