【发布时间】:2017-09-08 16:03:23
【问题描述】:
在 pymongo 中,我正在执行这样的排序查询:
from pymongo import MongoClient
client = MongoClient()
dbase = client[dbname]
collection = dbase[symbol]
start = time.time()
cursor = collection.find().sort([{'_id', -1}]).limit(6000)
data = list(cursor)
现在尝试在 R 中做同样的事情...
library("RMongo")
mongo <- mongoDbConnect("dbname", "localhost", 27017)
query = '{sort({_id: -1})}'
output <- dbGetQuery(mongo, "symbol", query, skip=0, limit=6000)
> output
data frame with 0 columns and 0 rows
这里正确的 JSON 查询字符串格式是什么?
【问题讨论】:
标签: mongodb sorting pymongo rmongo