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

Session support #36

Open
gil-opplane opened this issue Nov 18, 2020 · 4 comments
Open

Session support #36

gil-opplane opened this issue Nov 18, 2020 · 4 comments

Comments

@gil-opplane
Copy link

Hey,

I've been looking at the code you implemented and, first of all, thanks for all the work.
Now, I have a task at hand where I need to use a transaction to create multiple collections and commit or abort depending on the jobs' success. This should be available on the latest mongo version (4.4), so I went searching for the class in your code where the notion of transaction or session was implemented. Unfortunately, I didn't find them.

Am I missing something? Or, if not, are you planning on implementing these notions soon?

Here's the documentation I've been looking at:

Thanks in advance.

@neoxic
Copy link
Owner

neoxic commented Nov 19, 2020

First, I'll answer your questions directly:

  1. No, there's no direct support for client sessions in lua-mongo;
  2. No, there are no plans to implement this API along with other rarely used features.

Now, on a positive note, Mongo C Driver like all other MongoDB drivers/clients is just a wrapper around MongoDB's wire protocol. The protocol of MongoDB is essentially BSON objects going back and forth. A driver provides some basic functionality that helps the user to avoid handling basic I/O, constructing commands and parsing responses themselves. Please note that different drivers have a different level of abstraction dealing with this task. For example, the PHP driver handles most high level abstractions like instances, objects, sessions, etc. itself without relying on the underlying C driver (mongo-c-driver). There are drivers that imple

There's a generic client:command() in lua-mongo that you can use to implement nearly all other commands and queries. In particular, take a look here for the underlying mechanics of Server Sessions: https://docs.mongodb.com/manual/reference/server-sessions/

@gil-opplane
Copy link
Author

Hi,

I'll look into the :command() method. I'm already using it in other parts with other tasks, I was just looking whether there was an easier way to do this through a direct method. Thanks nonetheless.

@neoxic
Copy link
Owner

neoxic commented Nov 20, 2020

I'm in favour to leave this issue open to see if there's demand for this feature and it's worth implementing it in the long run.

@neoxic neoxic reopened this Nov 20, 2020
@gil-opplane
Copy link
Author

Hi,

Sure, thanks. I'll see what I can do on my side, but I'll keep a close look on this.

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

No branches or pull requests

2 participants