[SERVER-23158] geoSearch returns no results when not searching on indexed field Created: 15/Mar/16  Updated: 25/Mar/16  Resolved: 25/Mar/16

Status: Closed
Project: Core Server
Component/s: Geo
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Mathias Stearn Assignee: Unassigned
Resolution: Won't Fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Operating System: ALL
Participants:

 Description   

It doesn't error and claims to succeed, but the results array is empty when it shouldn't be.

db.coll.insert({_id: 1, point: [0, 0], indexed: 1, unindexed: 1});
assert.commandWorked(db.coll.ensureIndex({point: 'geoHaystack', indexed: 1}, { bucketSize:1}));
function geoSearch(search) {
    return assert.commandWorked(
        db.coll.runCommand('geoSearch', {near: [0, 0], maxDistance: 1, search: search}));
}
 
// Try with search on indexed field. (works)
assert.eq(geoSearch({indexed: 1}).results.length, 1, "indexed");
 
// Try with search on unindexed field. (fails)
assert.eq(geoSearch({unindexed: 1}).results.length, 1, "unindexed");
 
// Try with empty search. (fails)
assert.eq(geoSearch({}).results.length, 1, "empty");



 Comments   
Comment by Max Hirschhorn [ 25/Mar/16 ]

We are not considering improvements to geoHaystack indexes at this time.

Generated at Thu Feb 08 04:02:33 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.