有谁知道hint
在使用包时如何向 mongo 查询添加参数rmongodb
?注意:hint
现在已弃用。
目前我使用mongo.find.all
查询是因为它的简单性而不是单独cursor
的buffer
命令。
mongo.find.all(mongo = mongo,
ns = "ops.weather",
query = "{\"where.zip_code\":\"60603\", \"what.currently.time\":{\"$gte\":1430936418}}",
sort = mongo.bson.empty(),
fields = list(what.currently.time = 1L,
what.currently.precipIntensity = 1L,
what.currently.temperature = 1L,
what.currently.windSpeed = 1L,
what.currently.windBearing = 1L,
where.zip_code = 1L,
where.latitude = 1L,
where.longitude = 1L,
what.observation_type = 1L),
limit = 0L,
skip = 0L,
options = 0L,
data.frame = TRUE)
在 mongo 中,查询看起来像这样,没有上面完整示例中的所有字段:
db.weather.find({"where.zip_code" : "60603","what.currently.time" : {"$gte" : 1430936418}}).hint("where.zip_code_1_what.currently.time_1")
该提示在 Mongo 中使用时明显提高了查询性能,因此在正在进行的 R 进程中实现它会很有用。
当前会话信息()
> sessionInfo()
R version 3.2.1 (2015-06-18)
Platform: i386-w64-mingw32/i386 (32-bit)
Running under: Windows 7 (build 7601) Service Pack 1
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] rmongodb_1.8.0
loaded via a namespace (and not attached):
[1] plyr_1.8.3 tools_3.2.1 rstudioapi_0.3.1 Rcpp_0.12.0 jsonlite_0.9.16