如何使用OR/和过滤器(mongoDB)在url请求中的位置?
example.com/stats?where={"id":"1fd08077bd"} -工作正常
但我也需要通过{"_created":{"$gte":"Thu, 14 Apr 2017 00:00:00 GMT"}}进行过滤。
我试过&and
example.com/stats?where={"id":"1fd08077bd"}&and{"_created":{"$gte":"Thu, 14 Apr 2017 00:00:00 GMT"}}但那是徒劳的。
发布于 2017-04-25 12:10:34
试试这个:
example.com/stats?where={"$and":[{"_created":{"$gte":"Thu, 14 Apr 2017 00:00:00 GMT"}},{"id":"1fd08077bd"}]}$and应该是where过滤器的一部分。注意日期格式。应该和你前夜的应用程序一样。
https://stackoverflow.com/questions/43609730
复制相似问题