c# - How to query RavenDB for document containing nested object of specified type -
i have ravendb query using index , need add condition checking nested objects type (these objects aren't separate documents)
entries = session.query<result, index>() /* conditions here */ .where(x => x.messages.any(m => m.gettype() == typeof(mymessage))) .tolist();
raven tells me, doesn't know how translate gettype. how can achieve this?
after long research found solution.
i added field index:
messagetypes = entry.messages.select(m => asdocument(m)["$type"].tostring())
asdocument()
returns ravenjobject
contains properties including $type
. property indexed, asking type quite simple
Comments
Post a Comment