Query returns document Id with lower case in projections fields

137 views
Skip to first unread message

Xevi Mayolas

unread,
Nov 19, 2014, 12:38:03 PM11/19/14
to rav...@googlegroups.com

I’m working with version 2.5 build 2939 and I’m experiencing this issue with the following data:

Executing the following projection query I'm getting the entire Id's converted to lower case, while the Name field keeps the original case:

var countries = from c in session.Query<Country>()
                                    where c.Name != null
                                    orderby c.Name
                                    select new { DisplayText = c.Name, Value = c.Id };


Here is the result:


Oren Eini (Ayende Rahien)

unread,
Nov 19, 2014, 12:55:18 PM11/19/14
to ravendb

What build are you using?

--
You received this message because you are subscribed to the Google Groups "RavenDB - 2nd generation document database" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Xevi Mayolas

unread,
Nov 19, 2014, 12:57:08 PM11/19/14
to rav...@googlegroups.com
I’m working with version 2.5 build 2939



Oren Eini (Ayende Rahien)

unread,
Nov 19, 2014, 4:00:26 PM11/19/14
to ravendb
Are you doing explicit projection? In this case, you are getting the data directly from the index, and it would be lower cased.

Hibernating Rhinos Ltd  

Oren Eini l CEO Mobile: + 972-52-548-6969

Office: +972-4-622-7811 l Fax: +972-153-4-622-7811

 

Xevi Mayolas

unread,
Nov 19, 2014, 5:54:02 PM11/19/14
to rav...@googlegroups.com
OK, now I see that, the indexes store the Id's in lower case, but I'm not able to get the Id from the document, What is the way for get the real Id?

Kijana Woodard

unread,
Nov 19, 2014, 6:05:36 PM11/19/14
to rav...@googlegroups.com

On Wed, Nov 19, 2014 at 4:54 PM, Xevi Mayolas <xevi...@gmail.com> wrote:
OK, now I see that, the indexes store the Id's in lower case, but I'm not able to get the Id from the document, What is the way for get the real Id?

--

Kijana Woodard

unread,
Nov 19, 2014, 6:08:58 PM11/19/14
to rav...@googlegroups.com
It might be overkill for your case, but a results transformer might behave better. I can't remember what happens with Id there.



Chris Marisic

unread,
Nov 20, 2014, 9:50:49 PM11/20/14
to rav...@googlegroups.com
You should also be able to store the id

Chris Marisic

unread,
Nov 20, 2014, 9:52:59 PM11/20/14
to rav...@googlegroups.com
FieldStorage.Yes that is, to embed the actual value in the index.

Not saying this is for everyone but when i index anything, i store ever single value. I never used indexes to return documents, i only ever read index results. If i want transactionally consistent data I will use Load or LoadStartingWith. I prefer the convention of everything is stale, everything is eventually consistent. Then make a select few things be consistent (like updates).

Kijana Woodard

unread,
Nov 21, 2014, 12:09:14 PM11/21/14
to rav...@googlegroups.com
Using values from the index makes sense. 
I've run into cases where the documents you get back no longer meet the criteria in the Where clause of the Query. If that matters, it can be confusing. :-]

--
Reply all
Reply to author
Forward
0 new messages