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