Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
RavenDB 2.x Beginner's Guide

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

Product type Book
Published in Sep 2013
Publisher Packt
ISBN-13 9781783283798
Pages 356 pages
Edition 1st Edition
Languages
Author (1):
Khaled Tannir Khaled Tannir
Profile icon Khaled Tannir

Table of Contents (21) Chapters

RavenDB 2.x Beginner's Guide
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Getting Started with RavenDB RavenDB Management Studio RavenDB.NET Client API RavenDB Indexes and Queries Advanced RavenDB Indexes and Queries Advanced RavenDB Document Capabilities RavenDB Administration Deploying RavenDB Scaling-out RavenDB RavenDB Profiling RavenDB HTTP API Putting It All Together Pop Quiz Answers Index

Time for action – deleting a document


You will add necessary code to the Main() method in the Program class to delete the Order with the Id field as Orders/B279855 from the Orders database:

  1. Add the following code snippet to the Main() method:

  2. Save all the files, build and run the solution.

  3. Switch to your Management Studio, and click on the Documents tab to display documents of the Orders database, and check that the document is no longer in the Orders database.

What just happened?

You just wrote the necessary code to update the Order with the Id field as Orders/B279855 and save the changes to the Orders database.

You begin by opening a RavenDB session (line 59 in the previous code snippet). Then, you load the Order with the Id as Orders/B279855 by calling the Load() method (line 61). Then, you call the Delete() method on the Session object and pass to it the Order ID you want to delete (line 62).

Then, you invoke the SaveChanges() method on the session object to delete the Order document permanently...

lock icon The rest of the chapter is locked
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.
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}