Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Order By calculated property
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Kijana Woodard  
View profile   Translate to Translated (View Original)
 More options Jul 9 2012, 6:54 pm
From: Kijana Woodard <kijana.wood...@gmail.com>
Date: Mon, 9 Jul 2012 17:54:16 -0500
Local: Mon, Jul 9 2012 6:54 pm
Subject: Re: [RavenDB] Re: Order By calculated property

If you're using HiLo Ids, the sorting won't necessarily be "in order"
either. Web farm or multiple desktop clients will pretty much ensure they
are out of time order. If you're looking for creation order, there's a
forum post about sorting by the metadata field, or you could of course add
your own datetime property.

On Mon, Jul 9, 2012 at 4:57 PM, Matt Warren <mattd...@gmail.com> wrote:
> I don't think it's common, because you don't normally sort by id, you
> normally have another fields you sort by (name, age, cost etc). And I can't
> think of a scenario where you'd need to store the integer portion, other
> than to sort on it.

> On Monday, 9 July 2012 22:39:47 UTC+1, Jon Wynveen wrote:

>> Yeah, you're probably right that I answered my own question. I guess I'm
>> kinda wondering if it's common or recommended to store the integer version
>> of the ID in the document.

>> On Monday, July 9, 2012 4:34:32 PM UTC-5, Matt Warren wrote:

>>> I think you answered your own question as you asked it ;-)

>>> You can *only *sort on fields that are stored in the index, because
>>> sorting happens at query time.

>>> On Monday, 9 July 2012 22:25:06 UTC+1, Jon Wynveen wrote:

>>>> Is there any way to order a query by a property that isn't stored in
>>>> Raven (as I write this, it sounds pretty obvious that Raven can't query
>>>> something it doesn't know about)?

>>>> What I'm trying to do is sort by the numeric ID instead of the full
>>>> string ID. I have an Id property on my model that is the full string ID
>>>> (e.g. "users/123"), and then a property called UserId that parses out just
>>>> the integer value from the string ID (e.g. 123). How can I sort by the
>>>> UserId? Right now it's decorated with [JsonIgnore] so that it doesn't get
>>>> stored (it feels like storing duplicate data, so I didn't want to store
>>>> it). Do I need to actually store it in order to sort by it?

>>>> Here is my User model:

>>>> public class User

>>>>> {

>>>>> public User()

>>>>> {

>>>>> Status = UserStatus.Active;

>>>>> }

>>>>> public string Id { get; set; }

>>>>> [JsonIgnore]

>>>>> public int UserId

>>>>> {

>>>>> get

>>>>> {

>>>>> int userId;

>>>>> int.TryParse(Id.Replace("**users/", ""), out userId);

>>>>> return userId;

>>>>> }

>>>>> }

>>>>> public string Username { get; set; }

>>>>> public string Password { get; set; }

>>>>> public string Email { get; set; }

>>>>> public string FirstName { get; set; }

>>>>> public string LastName { get; set; }

>>>>> public string Location { get; set; }

>>>>> public bool OptIn { get; set; }

>>>>>> public DateTime LastActivity { get; set; }

>>>>> public UserStatus Status { get; set; }

>>>>> public bool IsDeleted { get; set; }

>>>>>> public string[] RoleIds { get; set; }

>>>>>> [JsonIgnore]

>>>>> public string FullName

>>>>> {

>>>>> get {

>>>>> return !string.IsNullOrEmpty(**FirstName) || !string.IsNullOrEmpty(**
>>>>>> LastName)

>>>>>        ? string.Format("{0} {1}", FirstName, LastName)

>>>>>        : null;

>>>>> }

>>>>> }

>>>>> }


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.