1
votes

Inside ravendb I have Properties documents. Each document has besides other properties UniqueCode. How can I query document for specific document inside ravendb management studio.

I tried inside Query (top level link) using

from d in docs.Properties
where d.UniqueCode == 1234
select d;

But I'm getting No results found

Metadata for each property document is

{
    "Raven-Entity-Name": "Properties",
    "Raven-Clr-Type": "MyProject.Test.Data.Domain.Model.Property, MyProject.Test.Data"
}
1
What purpose does "properties" serve? - Phill
just an entity name (document in this case). Can be Users or anything else from domain model. - user1765862
It sounds like your domain is designed poorly. You shouldn't have a catch all object/collection. - Phill
I am hoping by "Can be Users or anything else.." you mean you want to do a similar query to this for other models, and not that you're using a Properties model to store unrelated entities in a generic way (as Phill interprets).. - gregmac

1 Answers

1
votes

The query UI in RavenDb Management Studio uses Lucene syntax, and operates on indexes.

You need to first define an index that includes any fields you want to be able to search on:

from p in docs.Properties
select new {
    p.UniqueCode
}

Now you can use lucene syntax to actually query this:

UniqueCode: 1234

Using the RavenDb sample, I will define a similar query:

ProductReorderLevel query

and then can find all products matching a specific value:

enter image description here