We have the following R code which fetches an entire collection from our mongodb cluster
mongo_uri <- "mongodb+srv://username:[email protected]/dbname?retryWrites=true&w=majority"
con <- mongolite::mongo('users', db = 'dbname', url = mongo_uri)
users <- con$find('{}')
In the following code, the _id is not returned. However, we want the _id returned, and then we want to use the _id along with the ObjectId.getTimestamp function to extract the date that the document was added to the collection.
Is this possible to do in R with mongolite?
Solved this one on my own.