mongodb/node-mongodb-native — pull request #1163 by sars (2014-04-17 12:42:17+00:00)
Title: Remove sort if it`s not set. It fixes very slow queries with findAndModify and sort

I have a collection with 500K + documents.
```javascript

PixelSchema = mongoose.Schema({
num: Number,
r: Number,
g: Number,
b: Number,
a: Number,
random: {type: Number, index: true},
used: {type: Boolean, index: true},
loc: {type: [Number], index: {type: '2d', min: 0, max: 2000}}
});

Pixel = mongoose.model('Pixel', PixelSchema);
```

When I update some document in this collection using findAndModify it takes very long time (>1 sec)

```2014-04-17T14:50:45.077+0300 [conn133] update noobjs_dev.pixels query: { _id: ObjectId('534fbe0b7698e90ad258142f'), used: false, loc: { $near: [ 600, 500 ] } } update: { $set: { used: false } } nscanned:1 nscannedObjects:1 nMatched:1 nModified:0 keyUpdates:0 numYields:0 1388ms
```

mongodb driver adds to the query empty sort object and if i remove it - query executed much faster (0,01 sec)