jeroen / mongolite

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

Request for Query Modifiers #145

Closed DavidHeslip closed 6 years ago

DavidHeslip commented 6 years ago

Hi there, Is there any intention or capability to add modifiers such as ".maxTimeMS(x)" to a query/cursor? Personally i'm looking for a way of setting the max query run time before a timeout error is returned but have failed to find any currently supported R package that allows for doing so. Is there anything planned for this sort of support using mongolite? I use the mongolite a load and its been really useful! Cheers, Dave

DavidHeslip commented 6 years ago

with release of 2.0 this is now supported! amazing work. cheers!

jeroen commented 6 years ago

Is it? Can you give an example?

DavidHeslip commented 6 years ago

this seems to work for maxTimeMS()

MongoProducts$run(command = '{"find": "collectionName" ,"filter": { "UID" : 12345 } ,"maxTimeMS":20}',simplify = FALSE)

Given a suitably long query to run, it returns an error: "Error: operation exceeded time limit"

And setting maxTimeMS to something longer returns data successfully, and setting it to 0 forces it to use the server default setting. then again i may just be massively wrong and just being optimistic. Cheers, Dave

jeroen commented 6 years ago

Ah yes you can set it in the run command indeed. I first thought you wanted to modify the data other data methods.