On this page
setVerboseShell()
在本页面
setVerboseShell
( )- setVerboseShell()方法将mongo shell 配置为打印每个操作的持续时间。
setVerboseShell()的格式为:
setVerboseShell(true)
setVerboseShell()采用一个布尔参数。指定true
或将参数保留为空白以激活详细 Shell。指定false
停用。
Example
下面的示例演示了详细 shell 的行为:
- 在mongo shell 中,将详细 shell 设置为
true
:
setVerboseShell(true)
- 将详细 shell 设置为
true
,然后运行db.collection.aggregate():
db.restaurants.aggregate(
[
{ $match: { "borough": "Queens", "cuisine": "Brazilian" } },
{ $group: { "_id": "$address.zipcode" , "count": { $sum: 1 } } }
]
);
- 除了返回操作结果之外,mongo shell 现在还显示有关操作持续时间的信息:
{ "_id" : "11377", "count" : 1 }
{ "_id" : "11368", "count" : 1 }
{ "_id" : "11101", "count" : 2 }
{ "_id" : "11106", "count" : 3 }
{ "_id" : "11103", "count" : 1 }
Fetched 5 record(s) in 0ms