问题
I'm currently trying to get some json data from mongoDB database, and I use restHeart plugin for make my query.
I need to filter my answer with all result that the property "_lastupdated_on" is lower than the current date.
I tried something like that but doesn't work :
http://test:8081/purge/colPurge?filter={'_lastupdated_on':{'$eq':'2016-03-03T14:33:00Z'}}
Any idea ?
Version mongo 3.2 / restheart 1.1.6
Dorian
回答1:
The restheart system properties (those starting with _) are not stored in the db and cannot used for filtering and sorting.
You need to put a real date property in the documents to achieve what you need.
A tricky to automatically inject a "last update" field would be using a representation transformer (have a look at this discussion https://github.com/SoftInstigate/restheart/issues/95)
来源:https://stackoverflow.com/questions/35778707/restheart-mongodb-filtering-by-date