mongolite

Unable to see all collections from a mongodb remote server using mongolite

感情迁移 提交于 2020-01-03 01:52:12
问题 This may be a trivial problem. Im able to connect to remote mongodb server. Im using mongolite for connecting to the db. My DB is mobileapps. I also dont know what to specify in 'collection'. i know i can specify any collection. library(mongolite) con=mongo(collection = "test", url = "mongodb://user:password@ds035965.mongolab.com:35965/mobileapps") Though it is connecting, but doesnt show any data. Also i dont understand why does it show this for str(con): why is jeroen there. Classes 'mongo'

mongolite - correct syntax for aggregate method

♀尐吖头ヾ 提交于 2019-12-24 01:09:17
问题 Data Here I'm using mongolite to insert dummy data into a test mongodb database: library(mongolite) ## create dummy data df <- data.frame(id = c(1,2,3,4), region = c("r1", "r1", "r2", "r2")) > df id region 1 1 r1 2 2 r1 3 3 r2 4 4 r2 ## insert into database mong <- mongo(collection = "test", db = "test", url = "mongodb://localhost") mong$insert(df) Question How do I find the number of records for each region using the aggregate method? Mongo Shell query This query returns the correct answer

r mongolite - date query

≯℡__Kan透↙ 提交于 2019-12-20 05:17:10
问题 Question Using the mongolite package in R , how do you query a database for a given date? Example Data Consider a test collection with two entries library(mongolite) ## create dummy data df <- data.frame(id = c(1,2), dte = as.POSIXct(c("2015-01-01","2015-01-02"))) > df id dte 1 1 2015-01-01 2 2 2015-01-02 ## insert into database mong <- mongo(collection = "test", db = "test", url = "mongodb://localhost") mong$insert(df) Mongo shell query To find the entries after a given date I would use db

R -How to pass value in mongolite Query

和自甴很熟 提交于 2019-12-02 13:07:00
问题 I'm using mongolite package to connect and retrieve data from MongoDB.How to pass value in mongolite find query ##connecting mongodb library(mongolite) mongo<-mongolite::mongo(collection = "Sample", db = "Test", url = "mongodb://User:123@Wyyuyu:13333/ty2_U",verbose = TRUE) ## getting all data from collection data from collection below query is working fine. values <- mongo$find() ## But I want to filter specific value by passing value. for(i in c("process","check","queue")) { values <- mongo

r mongolite - date query

淺唱寂寞╮ 提交于 2019-12-02 06:13:45
Question Using the mongolite package in R , how do you query a database for a given date? Example Data Consider a test collection with two entries library(mongolite) ## create dummy data df <- data.frame(id = c(1,2), dte = as.POSIXct(c("2015-01-01","2015-01-02"))) > df id dte 1 1 2015-01-01 2 2 2015-01-02 ## insert into database mong <- mongo(collection = "test", db = "test", url = "mongodb://localhost") mong$insert(df) Mongo shell query To find the entries after a given date I would use db.test.find({"dte" : {"$gt" : new ISODate("2015-01-01")}}) How can I reproduce this query in R using

R -How to pass value in mongolite Query

放肆的年华 提交于 2019-12-02 04:46:24
I'm using mongolite package to connect and retrieve data from MongoDB.How to pass value in mongolite find query ##connecting mongodb library(mongolite) mongo<-mongolite::mongo(collection = "Sample", db = "Test", url = "mongodb://User:123@Wyyuyu:13333/ty2_U",verbose = TRUE) ## getting all data from collection data from collection below query is working fine. values <- mongo$find() ## But I want to filter specific value by passing value. for(i in c("process","check","queue")) { values <- mongo$find('{"field" : i}',) } if I tried above code i'm getting getting below issues . please help me to

R : Updating an entry in mongodb using mongolite

北战南征 提交于 2019-11-30 20:36:33
I have a mongo database with information that I am passing to some R scripts for analysis. I am currently using the mongolite package to pass the information from mongo to R . I have a field in each mongo entry called checkedByR , which is a binary that indicates whether the entry has been analysed by the R scripts already. Specifically, I am collecting a mongo entry by its respective mongo ID, running the scripts on the entry, assigning the checkedByR field with a 1 , and then moving on. For completeness, I am querying the database with the following request: library(mongolite) mongoID <-

R : Updating an entry in mongodb using mongolite

可紊 提交于 2019-11-30 04:52:31
问题 I have a mongo database with information that I am passing to some R scripts for analysis. I am currently using the mongolite package to pass the information from mongo to R . I have a field in each mongo entry called checkedByR , which is a binary that indicates whether the entry has been analysed by the R scripts already. Specifically, I am collecting a mongo entry by its respective mongo ID, running the scripts on the entry, assigning the checkedByR field with a 1 , and then moving on. For