[JAVA-2121] Sort Created: 24/Feb/16  Updated: 11/Sep/19  Resolved: 24/Feb/16

Status: Closed
Project: Java Driver
Component/s: Query Operations
Affects Version/s: 3.2.2
Fix Version/s: None

Type: Task Priority: Major - P3
Reporter: sorabh sahu Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

windows 7, 64 bit



 Description   

i have collection like this

{"index":"1.1.1"} {"index":"1.1.2"}

.......................

{"index":"1.1.9"} {"index":"1.1.10"} {"index":"1.1.1.1"}

and i want to fetch 1.1.1 to 1.1.
d+$ results in DESC order,
so for this regex will be ^1.1[.]
d+$, and from this i getting correct data,
but after DESC ordering applied iam getting all data correct but its order is not correct i'm getting :

{"index":"1.1.1"} {"index":"1.1.10"} {"index":"1.1.2"}

.......................

{"index":"1.1.9"}

So why this is happening ? according to DESC it has to show me 1.1.10 after 1.1.9.

please help me if i can do this with methods substring and last indexof .



 Comments   
Comment by Jeffrey Yemin [ 24/Feb/16 ]

The JAVA project is intended for reporting bugs against or requesting new features in the MongoDB Java driver. Please direct general usage questions about the driver or about MongoDB to our user forum or to Stack Overflow.

Regards,
Jeff

Comment by sorabh sahu [ 24/Feb/16 ]

REFORMAT
i have collection like this

{"index":"1.1.1"}

{"index":"1.1.2"}

.................

{"index":"1.1.9"}

{"index":"1.1.10"}

{"index":"1.1.1.1"}

.

and i want to fetch 1.1.1 to 1.1.d+$ results in DESC order.
so for this regex will be ^1.1[.] d+$ .
and from this i getting correct data,
but after DESC ordering applied iam getting all data correct but its order is not correct i'm getting :

{"index":"1.1.1"}

{"index":"1.1.10"}

{"index":"1.1.2"}

................

{"index":"1.1.9"}

.

So why this is happening ? according to DESC it has to show me 1.1.10 after 1.1.9.

please help me if i can do this with methods substring and last indexof .

Generated at Thu Feb 08 08:56:23 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.