Skip to main content

Is it possible in the MongoDB reader to have a JSON Query similar to

{"_id" : { "gte" : { "$date" : "@DateTimeFormat(@DateTimeAdd(@DateTimeNow(local),-P7D),%Y-%m-%dT%H:%M:00.000)Z" } } }

I have tried putting the entirety into a User Parameter, but the date section does not get calculated before being sent to MongoDB, leading to a warning being of the following.

MONGODB3 reader: Feature Type Parametr 'mongodb_query_document' has invalid value '{"_id" : { "gte" : { "$date" : "@DateTimeFormat(@DateTimeAdd(@DateTimeNow(local)' for feature type

Hi @svteshipley​ thanks for your question! I am not 100% sure if this would be possible straight from the reader. However, you might be able to create an attribute value from the user parameter (e.g. AttributeCreator/AttributeManager) that does calculate the date properly and then use a FeatureReader to read in from MongoDB using the new attribute value as the query.

 

If this does not work please let us know and we can try to investigate this further.


Reply