简体   繁体   English

Restheart MongoDB按日期过滤

[英]Restheart mongodb filtering by date

I'm currently trying to get some json data from mongoDB database, and I use restHeart plugin for make my query. 我目前正在尝试从mongoDB数据库中获取一些json数据,并且我使用restHeart插件进行查询。

I need to filter my answer with all result that the property "_lastupdated_on" is lower than the current date. 我需要使用属性“ _lastupdated_on”低于当前日期的所有结果来过滤答案。

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 版本mongo 3.2 / restheart 1.1.6

Dorian 多里安

The restheart system properties (those starting with _) are not stored in the db and cannot used for filtering and sorting. restheart系统属性(以_开头的属性)未存储在db中,并且不能用于过滤和排序。

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://github.com/SoftInstigate/restheart/issues/95

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM