Serious problem in using Sort functionality.

87 views
Skip to first unread message

Mayur Ahir

unread,
Nov 25, 2011, 7:42:58 AM11/25/11
to yiimong...@googlegroups.com
I am having big trouble in using Sort functionality of YiiMongoDbSuite. Please help me here is my code.

http://pastebin.com/raw.php?i=gfbha56Y

The thing is I am able to execute above things except SORT rest all filters are working fine.

Attila Nagy

unread,
Nov 25, 2011, 8:19:30 AM11/25/11
to yiimong...@googlegroups.com
On Fri, Nov 25, 2011 at 1:42 PM, Mayur Ahir <ahir...@gmail.com> wrote:
> I am having big trouble in using Sort functionality of YiiMongoDbSuite.
> Please help me here is my code.
>
> http://pastebin.com/raw.php?i=gfbha56Y

your code seems to be fine to me. Are you aware, that MongoDB does not
support locales in sorting? It will sort only by the default english
alphabet, and also case sensitive: uppercase letters will precede the
lower case letters.

So this is a 'valid' alphabetical sort by the mongo:

1984, December, February, January, apple, banana, foobar

--
Nagy Attila Gabor

Mayur Ahir

unread,
Nov 25, 2011, 8:48:51 AM11/25/11
to yiimong...@googlegroups.com
Yes I am aware of that and that isn't my real concern the problem is it just doesn't sort anything. I have tried with both options EMongoCriteria::SORT_DESC and EMongoCriteria::SORT_ASC on last_modified which is MongoDate() Object.

Attila Nagy

unread,
Nov 25, 2011, 8:54:23 AM11/25/11
to yiimong...@googlegroups.com

does it work for other fields? (string or number type?)


--
Nagy Attila Gabor

Mayur Ahir

unread,
Nov 25, 2011, 9:03:56 AM11/25/11
to yiimong...@googlegroups.com
I have tried it with almost all kinds of types e.g. category, msg_body etc but still no success... :(

Attila Nagy

unread,
Nov 25, 2011, 9:45:58 AM11/25/11
to yiimong...@googlegroups.com
On Fri, Nov 25, 2011 at 3:03 PM, Mayur Ahir <ahir...@gmail.com> wrote:
> I have tried it with almost all kinds of types e.g. category, msg_body etc
> but still no success... :(
>

hmm, what is this 'tenant()' method doing on your Messages::model()?
does it return the original model?


--
Nagy Attila Gabor

Mayur Ahir

unread,
Nov 27, 2011, 1:59:17 PM11/27/11
to yiimong...@googlegroups.com
tenant() is just a chained method which return original model with required data. I have also tried without using
i.e.
$return_messages = Messages::model()->findAll($criteria);

Mayur Ahir

unread,
Nov 29, 2011, 7:12:56 AM11/29/11
to yiimong...@googlegroups.com
Ok this is working now problem was with overlapping sort queries.
Reply all
Reply to author
Forward
0 new messages