简体   繁体   English

使用rmongodb或RMongo获取R中的数据统计信息

[英]Get data statistics in R with rmongodb or RMongo

Using robomongo I can get basic description of the data using 使用robomongo,我可以使用来获取数据的基本描述

db.getCollection('Exempt').stats()

but i cannot seem to get this info in nR using the rmongodb or RMongo packages. 但是我似乎无法使用rmongodb或RMongo软件包在nR中获得此信息。

Can anyone please help? 谁能帮忙吗?

Regards, Abhishek 问候,Abhishek

You can get this information (and more) using library(mongolite) . 您可以使用library(mongolite)获得此信息(以及更多信息library(mongolite) The command you want is mongo$info() 您想要的命令是mongo$info()

library(mongolite)

mongo <- mongo(collection = "test", db = "test")
info <- mongo$info()
info$stats

# $ns
# [1] "test.test"
# 
# $count
# [1] 0
# 
# $size
# [1] 0
# 
# $storageSize
# [1] 8192
# 
# $numExtents
# [1] 1
# 
# $nindexes
# [1] 1
# 
# $lastExtentSize
# [1] 8192
# 
# $paddingFactor
# [1] 1
# 
# $systemFlags
# [1] 1
# 
# $userFlags
# [1] 1
# 
# $totalIndexSize
# [1] 8176
# 
# $indexSizes
# $indexSizes$`_id_`
# [1] 8176
# 
# 
# $ok
# [1] 1

rm(mongo); gc()

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

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