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(); 
    } 
} 

1 Answer 1

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.

2
  • 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. Sep 5, 2013 at 4: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 (localhost:8082/raven/studio.html) Sep 5, 2013 at 4:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.