Rmongo 查询函数报错
Rmongo query function giving error
我正在尝试使用 Rmongo library.But 查询函数在 R 中连接 mongodb,但出现错误。
> chn = mongoDbConnect("marketing_db", host = 'localhost', port = 27017)
> print(dbShowCollections(chn))
character(0)
> results = dbGetQuery(chn, marketing_data, {}, 0, 5)
Error in dbGetQuery(chn, marketing_data, { :
object 'marketing_data' not found
> results = dbGetQuery(chn, "marketing_data", {}, 0, 5)
Error in (function (classes, fdef, mtable) :
unable to find an inherited method for function ‘dbGetQuery’ for signature ‘"RMongo", "character", "NULL", "numeric", "numeric"’
> results = dbGetQuery(chn, "marketing_data", query = {}, skip = 0, limit = 5)
Error in (function (classes, fdef, mtable) :
unable to find an inherited method for function ‘dbGetQuery’ for signature ‘"RMongo", "character", "NULL", "numeric", "numeric"’
其中 marketing_db 是数据库,marketing_data 是我的 mongodb
中的集合
以下是 mongo 控制台的输出:
> show dbs
admin 0.000GB
config 0.000GB
local 0.000GB
marketing_db 0.001GB
myblogs 0.000GB
test 0.003GB
> use marketing_db
switched to db marketing_db
> show collections
marketing_data
> db.marketing_data.count()
7414
> db.marketing_data.find().pretty().limit(1)
{
"_id" : ObjectId("5b1d65c6cc6e576297462cdc"),
"custAge" : 55,
"profession" : "admin.",
"marital" : "single"
}
我将 R 用于 windows 3.4.3 和 MongoDB 3.6.5
请帮助解决这个错误。
尝试将查询 json 作为字符串传递:
results = dbGetQuery(chn, "marketing_data", "{}", 0, 5)
我正在尝试使用 Rmongo library.But 查询函数在 R 中连接 mongodb,但出现错误。
> chn = mongoDbConnect("marketing_db", host = 'localhost', port = 27017)
> print(dbShowCollections(chn))
character(0)
> results = dbGetQuery(chn, marketing_data, {}, 0, 5)
Error in dbGetQuery(chn, marketing_data, { :
object 'marketing_data' not found
> results = dbGetQuery(chn, "marketing_data", {}, 0, 5)
Error in (function (classes, fdef, mtable) :
unable to find an inherited method for function ‘dbGetQuery’ for signature ‘"RMongo", "character", "NULL", "numeric", "numeric"’
> results = dbGetQuery(chn, "marketing_data", query = {}, skip = 0, limit = 5)
Error in (function (classes, fdef, mtable) :
unable to find an inherited method for function ‘dbGetQuery’ for signature ‘"RMongo", "character", "NULL", "numeric", "numeric"’
其中 marketing_db 是数据库,marketing_data 是我的 mongodb
中的集合以下是 mongo 控制台的输出:
> show dbs
admin 0.000GB
config 0.000GB
local 0.000GB
marketing_db 0.001GB
myblogs 0.000GB
test 0.003GB
> use marketing_db
switched to db marketing_db
> show collections
marketing_data
> db.marketing_data.count()
7414
> db.marketing_data.find().pretty().limit(1)
{
"_id" : ObjectId("5b1d65c6cc6e576297462cdc"),
"custAge" : 55,
"profession" : "admin.",
"marital" : "single"
}
我将 R 用于 windows 3.4.3 和 MongoDB 3.6.5
请帮助解决这个错误。
尝试将查询 json 作为字符串传递:
results = dbGetQuery(chn, "marketing_data", "{}", 0, 5)