@m6 The MongoDB reader in the FeatureReader should support a spatial query. If you use Envelope Intersects then FME will send the MBR (minimum bounding rectangle) to the database and return the results. If you use any other spatial predicate (i.e Contains) then the query is carried out in two steps:
- FME sends the MBR to the database and returns the results
- FME uses internal functionality to clean-up the query and clip the data to the original query polygon.
This presumes your MongoDB collection has a spatial index on your locations. Use Robomongo or something similar to check the indices on your collections.

This approach is used for many of the spatial database formats FME supports.
Only the FeatureReader supports the spatial query for MongoDB. The FME MongoDB 'native' reader does not yet support spatial queries and will read the entire dataset and then clip to the spatial envelope.
Thanks Mark - I will give Robomongo a try and respond again.
Hi Mark,
thank you for your previous reply to this topic, it seemed to do the trick while I was doing some testing. The envelope intersect working well where other spatial filters failed. However, I have since written a very large database to MongoDB and the Feature Reader seems to unable to cope with it.
I have used Studio3T/ Romomongo to re-build the 2D spatial indexes on the collections to make sure that isn't the problem. But in the latest FME build (where envelope intersect has been replaced with bounding box intersect - which I suspect are identical but with a different name) it appears from the log that FME may be attempting to build a temporary FFS of the data to query against. Could this be the case? If so, the size of the database will yield the Mongo Feature reader un-usable here.
Many thanks
Matt
Hi Mark,
thank you for your previous reply to this topic, it seemed to do the trick while I was doing some testing. The envelope intersect working well where other spatial filters failed. However, I have since written a very large database to MongoDB and the Feature Reader seems to unable to cope with it.
I have used Studio3T/ Romomongo to re-build the 2D spatial indexes on the collections to make sure that isn't the problem. But in the latest FME build (where envelope intersect has been replaced with bounding box intersect - which I suspect are identical but with a different name) it appears from the log that FME may be attempting to build a temporary FFS of the data to query against. Could this be the case? If so, the size of the database will yield the Mongo Feature reader un-usable here.
Many thanks
Matt
Hi Matt:
I tested this in FME 2018.1 and I don't see FME caching to an FFS file. FME will cache to an FFS file if you have either:
- a data Inspector enabled in the workspace
- you have enabled Enable Feature Caching (or Run with Full Inspection in earlier versions of FME)
FME 2018 we did change Envelope Intersect with Bounding Boxes Intersect