当我使用pymongo在python中运行convertToCapped命令时,它给出错误,变量大小未定义 [英] When i run convertToCapped command in python using pymongo then it gives error that variable size is not defind

查看:111
本文介绍了当我使用pymongo在python中运行convertToCapped命令时,它给出错误,变量大小未定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

命令是:

db.command({'convertToCapped': 'info', size:100000})

Traceback (most recent call last):
File "<pyshell#18>", line 1, in <module>
db.command({'convertToCapped': 'info', size:100000})
NameError: name 'size' is not defined


推荐答案

据我了解,您需要使用pymongo运行如下命令:

From what I understand you need to run the command like this with pymongo:

db.command( "convertToCapped', 'info', size = 100000 );

http://api.mongodb.org/python/current/api/pymongo/database.html#pymongo.database.Database.command

这篇关于当我使用pymongo在python中运行convertToCapped命令时,它给出错误,变量大小未定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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