Skip to main content
Solved

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


andrew_r
Contributor
Forum|alt.badge.img

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

Best answer by jakemolnar

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.

View original
Did this help you find an answer to your question?

2 replies

jakemolnar
Forum|alt.badge.img
  • Best Answer
  • April 14, 2017

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.


andrew_r
Contributor
Forum|alt.badge.img
  • Author
  • Contributor
  • April 20, 2017
jakemolnar wrote:

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!

 

 


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings