Menu

#14 order by does not use numeric comparisons when it should

open
nobody
None
5
2005-02-10
2005-02-10
No

If you add enough <author>s to one of the <book>s in
bib.xml to make more than 9 and run the sample app and
then issue this query:

<tag>
{
for $f in /bib/book
order by count($f/author)
return
<count>
{count($f/author)}
</count>
}
</tag>

You get something like:

<tag><count>0</count>
<count>1</count>
<count>1</count>
<count>12</count>
<count>3</count>
</tag>

I would expect to see:
<tag><count>0</count>
<count>1</count>
<count>1</count>
<count>3</count>
<count>12</count>
</tag>

Since count() is a numeric function, XQEngine should
know to sort numerically.

Discussion


Log in to post a comment.

MongoDB Logo MongoDB