Menu
  • HOME
  • TAGS

rmongodb query combining AND, OR, and string match

rmongodb

Did you try to write some code / read rmongodb vignettes? You need soomething like this: and_1 = list("$and" = list( list("Var1Path" = list("$regex" = "20072" )), list("Var2Path" = list("$regex" = "30033" )) )) and_2 = list("$and" = list( list("Var1Path" = list("$regex" = "30033" )), list("Var2Path" = list("$regex" = "20072"...

How to query a Document by ObjectId with rmongodb

r,mongodb,rmongodb

This should work: result <- mongo.find(Connexion, "db.col", query=list('_id' = mongo.oid.from.string("5571849db1969e0a6eb32731"))) ...

Rmongodb package date object

mongodb-query,rmongodb

Please, use mongo.bson.from.list() function, which directly converts R's types into MongoDB types. posix_time <- strptime(x = "2015-1-5 20:00:00", format = '%F') query <- mongo.bson.from.list(list("Date_time" = list("$lte" = posix_time))) sample <- mongo.find.all(mongo,"db.coll",query) Also mongo.bson.from.list() is much faster because it avoids JSON parsing. P.S. In fact mongo.bson.from.JSON uses it under the hood....

Pass shiny UI text input into rmongodb query

shiny,shiny-server,rmongodb,shinyapps

There is no need for a reactive command in your server function. I have simplified and corrected your function below: server <- function(input, output) { output$main_plot <- renderPlot({ nameFinal <- paste0(input$userName) query = mongo.bson.buffer.create() mongo.bson.buffer.append(query, "user", nameFinal) query = mongo.bson.from.buffer(query) queryresults <- mongo.find.all(mongo=mongo, ns = "simpledb.main", query=query) if (length(queryresults) >...

Balance reads in a MongoDB replica set with rmongodb

r,mongodb,rmongodb

Sorry, no solution so far. The underlying C connector is not supporting this functionality. There is a new mongoC library available which supports this. But moving rmongodb to this library will take a lot of time which is currently not available.

Fix Mangled Data Frame

mongodb,data.frame,rmongodb

Here's what I built with thelatemail's help: mongolist.to.data.frame <- function(x){ x.names <- names(x[[1]][2][[1]]) x <- data.frame(setNames(lapply(x.names, function(y) sapply(x[[1]][-1], function(z) if(is.null(z[[y]])) return(NA) else return(z[[y]]))),x.names)) return(x) } ...

Set profile level using rmongodb

r,mongodb,profile,rmongodb

Based on review of documentation there is nothing related to profiling there. So I assume that it is not possible. I suggest you to ask for a feature request on their github...

rmongodb: $in-query doesn't work

r,mongodb,rmongodb

Short answer - R's unnamed lists are converted into MongoDB arrays. So in case your query looks like {id : {$in : [17]}}, your R's bson constructor should be mongo.bson.from.list(list(id = list("$in" = list(17)))) Long answer 1. First of all, please, use mongo.bson.from.list, it is much more efficient and more...