我如何做比大于/小于使用MongoDB? [英] How do I do greater than/less than using MongoDB?

查看:171
本文介绍了我如何做比大于/小于使用MongoDB?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用pymongo驱动程序。

I'm using the pymongo driver.

有人可以看看pymongo,告诉我如何做大于?我米用来干什么的:一切

Can someone take a look at pymongo and tell me how to do greater than? I"m used to doing : for everything.

推荐答案

你见过的文档?从手册中获取:

Have you seen the doc ? Take from the manual :

>>> d = datetime.datetime(2009, 11, 12, 12)
>>> for post in posts.find({"date": {"$lt": d}}).sort("author"):
...   post
...
{u'date': datetime.datetime(2009, 11, 10, 10, 45), u'text': u'and pretty easy too!', u'_id': ObjectId('...'), u'author': u'Eliot', u'title': u'MongoDB is fun'}
{u'date': datetime.datetime(2009, 11, 12, 11, 14), u'text': u'Another post!', u'_id': ObjectId('...'), u'author': u'Mike', u'tags': [u'bulk', u'insert']}

这篇关于我如何做比大于/小于使用MongoDB?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆