jeroen / mongolite

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

Always include "_id" field in the find method #114

Closed bonartm closed 6 years ago

bonartm commented 6 years ago

when fetching data from mongodb via

con <- mongo(collection)
con$find()

the '_id' field is supressed. To get the '_id' field I have to call con$find(fields = '{"_id":1}') but then I don't get all the other variables. So to really get all variables I have to explicitly name all the variables in the projection which is bad if I have hundreds of variables.

Am I missing something? Otherwise I would suggest to change the default behaviour and always include the '_id' field (as it is the default behaviour of the native "db.collection.find()" method).

bonartm commented 6 years ago

Sorry my fault. You can of course do con$find(fields = '{}').