jeroen/mongolite

the single cell seurat object store in mongodb in R environment issue

honghh2018 opened this issue · 0 comments

Hi developer,
Thanks for the great tools to manipulate the mongod

Here is my problem:
how to insert the object data (size 1Gb) into the mongo using R script package mongolite
code below:
library(mongolite)

data <- readRDS("hg19_seurat.rds")

binary_data <- serialize(data, NULL)

mongo_con <- mongo(collection = "seurat_col", db = "seurat_db", url = "mongodb://127.0.0.1")

gridfs_id <- mongo_con$gridfs$put(data = binary_data, filename = "seurat_data")

mongo_con$disconnect()

mongo_con <- mongo(collection = "seurat_col", db = "seurat_db", url = "mongodb://127.0.0.1")

binary_data1 <- mongo_con$gridfs$get(gridfs_id)$read()

seurat_obj1 <- unserialize(binary_data1)

identical(data, seurat_obj1)

the above code show me error

can not get the object "binary_data1"
how can i fix this issue?
any advice would be appreciated.
Best,
hanhuihong