Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update mongo version? (7.0) #264

Closed
ghost opened this issue Apr 24, 2024 · 10 comments · Fixed by #265
Closed

update mongo version? (7.0) #264

ghost opened this issue Apr 24, 2024 · 10 comments · Fixed by #265

Comments

@ghost
Copy link

ghost commented Apr 24, 2024

Anyone maintaining this? Would like to use the percentile operator in the current (7.0) version.

https://www.mongodb.com/docs/manual/release-notes/7.0/#aggregation

@jeroen
Copy link
Owner

jeroen commented Apr 24, 2024

Does this require an update of the C driver?

@ghost
Copy link
Author

ghost commented Apr 24, 2024

Does this require an update of the C driver?

https://www.mongodb.com/docs/languages/c/c-driver/current/

If the driver is <= 1.23, I believe so.

@jeroen
Copy link
Owner

jeroen commented Apr 24, 2024

OK I see. I'll try to update it soon then.

@jeroen
Copy link
Owner

jeroen commented Apr 24, 2024

I updated it to 1.26.2. You can install the devel version from https://jeroen.r-universe.dev/mongolite. Can you let us know if it works for you?

@ghost
Copy link
Author

ghost commented Apr 24, 2024

No. Using mongolite 2.8.0 r-4.3 windows.

Here's an example from mongo:

# connection: test_db

mongo_data <- fromJSON('[
   { "studentId": "2345", "test01": 62, "test02": 81, "test03": 80 },
   { "studentId": "2356", "test01": 60, "test02": 83, "test03": 79 },
   { "studentId": "2358", "test01": 67, "test02": 82, "test03": 78 },
   { "studentId": "2367", "test01": 64, "test02": 72, "test03": 77 },
   { "studentId": "2369", "test01": 60, "test02": 53, "test03": 72 }]')

test_db$insert(mongo_data)

pipeline <- '[
   {
      "$group": {
         "_id": null,
         "test01_percentiles": {
            "$percentile": {
               "input": "$test01",
               "p": [ 0.95 ],
               "method": "approximate"
            }
         }
      }
   }
]'


test_db$aggregate(pipeline)

output:

Error: unknown group operator '$percentile'

@jeroen
Copy link
Owner

jeroen commented Apr 24, 2024

That looks like a server error? Are you sure your server runs mongodb 7?

@jeroen
Copy link
Owner

jeroen commented Apr 24, 2024

@kevinAlbs @eramongodb do we need to set something in the mongo-c-driver client to enable mongodb-7 APIs?

@kevinAlbs
Copy link
Contributor

Does this require an update of the C driver?

No. I expect the $percentile operator can be used on C driver versions prior to 1.23. Aggregate operators are sent as-is from the driver. Here is an example using the C driver to run the $percentile operator. It was run with C driver 1.22.2 and server 7.0.8. I suggest confirming the server is 7.0.0 or newer.

@ghost
Copy link
Author

ghost commented Apr 24, 2024

@jeroen @kevinAlbs

Thanks for all the help. Confirming the server is on 7.0 resolved the issue.
Thank's jeroen for the amazingly quick response.

@jeroen
Copy link
Owner

jeroen commented Apr 25, 2024

OK well I updated mongolite anyway to mongo-c-driver 1.26.2, even though that turned out to be not the actual problem..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants