我正在使用mongomatic gem
以下是索引列表:
Address.collection.index_information #=>
{"_id_"=>
{"v"=>1, "key"=>{"_id"=>1}, "ns"=>"downloader_test.proxies", "name"=>"_id_"},
"address_1"=>
{"v"=>1,
"key"=>{"address"=>1},
"unique"=>true,
"ns"=>"downloader_test.proxies",
"name"=>"address_1"},
"randomizer_1"=>
{"v"=>1,
"key"=>{"randomizer"=>1},
"ns"=>"downloader_test.proxies",
"name"=>"randomizer_1",
"2d"=>true}}
当我尝试在查询中使用 $near 运算符时,我收到了这样的错误:
Address.collection.find_one('randomizer' => { '$near' => [129, 0] }) #=>
Mongo::OperationFailure: can't find any special indices: 2d (needs index),
2dsphere (needs index)
我不明白为什么它不起作用,它有随机发生器的索引但不能使用它。
可能是什么问题?