index, skip and limit ignored?

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Won't Fix
    • Priority: Minor - P4
    • None
    • Affects Version/s: 2.2
    • Component/s: Query Operations
    • None
    • Environment:
      rails, mongoid, kaminari

      mongo (1.6.0)
          mongoid (2.4.5)
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      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

            Assignee:
            Unassigned
            Reporter:
            Nathan
            None
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: