# MongoServerError: geoHaystack index is not supported in this version

- **ID:** `mongodb/geo-haystack-index-not-supported`
- **Domain:** mongodb
- **Category:** config_error
- **Error Code:** `404`
- **Verification:** ai_generated
- **Fix Rate:** 90%

## Root Cause

The geoHaystack index type was deprecated and removed in MongoDB 5.0+, but the application still tries to create or use it.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| mongodb 7.0 | active | — | — |
| mongodb 6.0 | active | — | — |
| mongodb 5.0 | active | — | — |

## Workarounds

1. **Replace geoHaystack with a 2dsphere index: db.collection.createIndex({ location: '2dsphere' }) and use $nearSphere or $geoWithin queries.** (90% success)
   ```
   Replace geoHaystack with a 2dsphere index: db.collection.createIndex({ location: '2dsphere' }) and use $nearSphere or $geoWithin queries.
   ```
2. **If bounding box queries are needed, use $geoWithin with $box: db.places.find({ location: { $geoWithin: { $box: [ [0,0], [10,10] ] } } })** (85% success)
   ```
   If bounding box queries are needed, use $geoWithin with $box: db.places.find({ location: { $geoWithin: { $box: [ [0,0], [10,10] ] } } })
   ```

## Dead Ends

- **** — Downgrading is not recommended and may cause data compatibility issues. (70% fail)
- **** — No such flag exists; the feature is completely removed. (95% fail)
