Solved

How does one apply a filter to the MongoDB reader to limit results?


Badge

I'm a GIS guy and new to MongoDB. I'm trying to use FME to read and analyze data in a Mongo database. The collection I'm trying to read has 10 million plus records so I'd like to be able to filter that down to a subset for testing. If this was an Oracle or ArcGIS reader I'd place a SQL whereclause on the reader to limit what FME starts with. On the MongoDB reader I don't see a whereclause option. I see a Collection Qualifer and a JSON query parameter on the Feature Type window, so is this where I would apply a MongoDB filter? I tried entering so MongoDB'ish find() code in this but it doesn't work, so maybe I'm entering it wrong.

To simplify an example, here's what I'd like to do on my reader in SQL:

select * from MyTable where MyStringField = 'MyClassification'

And here's the Mongo translation of the same thing:

db.MyTable.find({ "MyStringField": "MyClassification" });

Now I'm left figuring out how to apply that same filter in the FME world

Thanks for any help you can provide

icon

Best answer by jakemolnar 14 April 2017, 03:29

View original

2 replies

Badge

You found the right field: the JSON Query parameter.

If you enter:

{ "MyStringField": "MyClassification" }

into the field, then you should get the result you're looking for.

This will be added to future version of the MongoDB reader documentation.

Badge

You found the right field: the JSON Query parameter.

If you enter:

{ "MyStringField": "MyClassification" }

into the field, then you should get the result you're looking for.

This will be added to future version of the MongoDB reader documentation.

Thank you!

 

 

Reply