jeroen / mongolite

Fast and Simple MongoDB Client for R
https://jeroen.github.io/mongolite/
284 stars 64 forks source link

Inconsistent use of "name" and "filename" in gridfs #257

Open baderd opened 7 months ago

baderd commented 7 months ago

Description

I can add entries with

mfs <- mongolite::gridfs(...)
mfs$write(
    name = my_filename_char, 
    con = serialize(my_data_frame, NULL), 
    metadata = some_char
)

But find() requires "filename" instead of "name" (otherwise I find nothing):

mfs$find(filename = my_filename_char)

However, the output shows "name" as corresponding column name.

I find this is inconsistent.

Furthermore, the mongoDB docu states "filename" as the field name for gridfs collections. Python also uses "filename" in its module.

I am using mongolite v2.7.2

Idea

With the next major version change, you could change the syntax to use only "filename" throughout to be consistent in the mongolite package itself and consistent with the mongoDB documentation.