0

I have a problem saving an object to Ravendb. Everytime i save the object into Ravendb , it only save this below Raven/Hilo/LoggingMessages { "Max": 32 } I don't even have property called Max on LoggingMessages class. And, it kept doing that.

I used this Ravendb in a project that use NserviceBus. My assumption is that the Ravendb Client library that is used by NserviceBus is different with other Ravendb Client. Because I have no problem saving an object of type LoggingMessage in other project that doesn't have NserviceBus.

LoggingMessage errormessage = new LoggingMessage(); 
errormessage.MessageBody = "test"; 
errormessage.MessageId = "test"; 

using (var store = new DocumentStore { ConnectionStringName = "RavenDB" } ) 
{ 
    store.Initialize(); 
    using (var session = store.OpenSession()) 
    { 
        session.Store(errormessage); 
        session.SaveChanges(); 
    } 
} 
Matt Johnson-Pint
  • 230,703
  • 74
  • 448
  • 575
user2709630
  • 11
  • 1
  • 3

1 Answers1

0

That's how RavenDB generates IDs. Its a system document. Don't worry about that.

What's probably happening is that you are saving this document to the database that NServiceBus is using, but you are looking at either the RavenDB System Database, or you are writing it to a separate one.

In Raven Studio, check the "databases" list in the upper-right corner.

In your code, you can set the database name either in the connection string, or as a parameter to the new DocumentStore constructor, or as a parameter to the OpenSession method.

Matt Johnson-Pint
  • 230,703
  • 74
  • 448
  • 575
  • Based on the code you wrote, I see no reason that you shouldn't find your document in the database. It should have an ID of something like `LoggingMessages/1`. – Matt Johnson-Pint Sep 05 '13 at 04:29
  • Thank you Matt. I did get the id like LoggingMessage/35 or something like that but the object itself doesn't show up in Ravendb Studio. If i use Raven Client that is another project that doesn't have nservicebus. I can see the object in Ravendb Studio (http://localhost:8082/raven/studio.html) – user2709630 Sep 05 '13 at 04:40