Closed FidelCastillo closed 6 years ago
That seems correct. Do you see anything if you do not pass the filter argument?
What exactly does your metadata look like? This seems to work for me:
# some example data
fs <- mongolite::gridfs("test")
fs$write('iris', serialize(iris, NULL), metadata = '{"author": "jeroen"}')
fs$write('mtcars', serialize(mtcars, NULL), metadata = '{"author": "jimmy"}')
fs$write('cars', serialize(cars, NULL), metadata = '{"author": "jimmy"}')
# shows files with author jimmy
fs$find('{"metadata.author": "jimmy"}')
# drop example data
fs$drop()
Are you sure you are using the correct db? What do you get for fs$find()
without filters?
Sorry I've got a few days off of my work. On Monday l'll be there. But I think that I can get the data from the gridFS
hi again, and sorry for delay... too busy in the last weeks.
this is what I have
library(mongolite) library(data.table) library(jsonlite)
conFiles <- mongo('MC.files', 'MC') conChunk <- mongo('MC.chunks', 'MC') fs <- gridfs("MC")
When I connect using the gridfd function I don't get any information
fs$find('{"metadata.CodMeta" : "123"}') [1] id name size date type
<0 rows> (or 0-length row.names)
But when I try with the mongo function I get the _id ,
data.table(conFiles$find('{"metadata.CodMeta":"123"}', fields = "{\"_id\":1}" )) _id 1: 5a8db149de310e302c1a59be 2: 5a8db149de310e302c1a59c4 3: 5a8db149de310e302c1a59c8 4: 5a8db0c4de310e302c19cda9 5: 5a8db149de310e302c1a59d4
5419: 5a8db0c4de310e302c19cd8b 5420: 5a8db0c4de310e302c19cd8f 5421: 5a8db0c4de310e302c19cd95 5422: 5a8db0c4de310e302c19cd9b 5423: 5a8db0c4de310e302c19cd9f
If I try the the empty find I don't have the data either
fs$find() [1] id name size date type
<0 rows> (or 0-length row.names)
Thank again, I'm sure that I'm pretty close
Ah you are using a custom prefix? Try this: gridfs("MC", prefix = "MC")
Hi, why I can't use "fs <- mongolite::gridfs("test")", it says "Error: 'gridfs' is not an exported object from 'namespace:mongolite'
You need the development version of the package:
devtools::install_github("jeroen/mongolite")
I got this error:
ERROR: configuration failed for package ‘mongolite’
You need to give more output if you want me to help you.
The CRAN version now has gridfs support so you no longer need to build from source:
install.packages("mongolite")
hi, I'm tring to use the GridFS functions, and I'm pretty sure that I'm doing something wrong.
This is the pymongo code that I'm tring to replicate in mongolite:
and this is the mongolite code that I'm using
but I'm not able to read the gridFs out file
I have this
thanks in advance