[JAVA-1035] index, skip and limit ignored? Created: 31/Oct/13  Updated: 11/Sep/19  Resolved: 31/Oct/13

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

Type: Task Priority: Minor - P4
Reporter: Nathan Assignee: Unassigned
Resolution: Won't Fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

rails, mongoid, kaminari

mongo (1.6.0)
mongoid (2.4.5)



 Description   

running this query (rails console)

irb(main):005:0> Company.where().order([:updated_at, :desc]).page(2350).per(100)
=> #<Mongoid::Criteria
selector: {},
options: {:sort=>[[:updated_at, :desc]], :limit=>100, :skip=>234900},
class: Company,
embedded: false>

i get this op in the log:

PRIMARY> db.currentOp()
{
"inprog" : [
{
"opid" : 452130769,
"active" : true,
"lockType" : "read",
"waitingForLock" : false,
"secs_running" : 5,
"op" : "query",
"ns" : "syn_production.contacts",
"query" : {
"$query" : {
"_type" :

{ "$in" : [ "Company" ] }

},
"$orderby" :

{ "updated_at" : -1 }

},
"client" : "10.32.2.108:34235",
"desc" : "conn",
"threadId" : "0x453ac940",
"connectionId" : 20536186,
"numYields" : 0
}
]
}

also, it's not using this index:

PRIMARY> db.contacts.getIndexes()
[
....,
{
"v" : 1,
"key" :

{ "updated_at" : -1 }

,
"ns" : "syn_production.contacts",
"name" : "updated_at_-1"
}
]

any pointers would be great



 Comments   
Comment by Jeffrey Yemin [ 31/Oct/13 ]

OK, thanks,

Comment by Jeffrey Yemin [ 31/Oct/13 ]

Ah, I didn't realize. I'll move this for you.

Comment by Jeffrey Yemin [ 31/Oct/13 ]

Since it's a question rather than a bug or feature request, I would try Stack Overflow.

Comment by Nathan [ 31/Oct/13 ]

ahh.. how about commercial support. feel free to delete. ill move it

Comment by Nathan [ 31/Oct/13 ]

haha, no idea where it should go. suggestions?

Comment by Jeffrey Yemin [ 31/Oct/13 ]

Hi Nathan,

Why did you open this issue in the JAVA driver project?

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