Reputation: 4286
I'm trying to store a JSON document (basically a Newtonsoft JObject in .Net) as a class property.
public class Something
{
public JObject ConfigurationData
{
get;set;
}
...
}
Basically it's arbitrary JSON configuration data that isn't known before-hand and need to searchable by an ravendb index, also need to be able to traverse it programmatically, use JSONPath on it, etc. Preferably without having to convert it back and forth to something else.
I've been reading about dynamic indexing, BlittableJsonReaderObject etc etc, but I can't seem to find a simple example with above, and some things seem to have changed since 4.0
If I understand correctly BlittableJsonReaderObject is more for storing raw json and reading it out as an object. Should I just store it as a JObject? Or is there some better way?
Upvotes: 3
Views: 175
Reputation: 269
Why not store the ConfigurationData
json it as a String
?
It will be searchable by RavenDb's FTS and you can also define Text Analyzers on that field in RavenDB's indexes.
Susbscribe to OnBeforeConversionToDocument
event and convert the JObject to the string
See https://ravendb.net/docs/article-page/4.2/Csharp/client-api/session/how-to/subscribe-to-events#onbeforeconversiontodocument
Upvotes: 1