-
Notifications
You must be signed in to change notification settings - Fork 12
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
Allow for transaction use within the extension? #33
Comments
Hi Pat, I'll see if I can compile a list of what would need to be done to support this. Thanks for the thorough analysis. I agree it would be a good feature to add to the extension if we can support this. Bear in mind that I am mainly a CF developer and really just a hack at Java. I have only maintained this repo with minor fixes but I'm pretty familiar with the code at this point. Hopefully we can make it happen. |
@sjdaniels what ever you can do is super appreciated. One thing also worth mentioning though is that if ever such a change should be brought to the extension, might as well try to update the java driver to most recent (4.4.1) as to properly support newest Mongo Server. As per Mongo's transaction documentation: ...Use the MongoDB driver updated for the version of your MongoDB deployment.... See compatibility sheet: https://docs.mongodb.com/drivers/java/sync/current/compatibility/ So, theoretically, if one wants to use Mongo Server 5.x, they really should be using the java driver 4.4... Maybe it would still work with older driver, but might not be a good idea... Just food for thought ;) Anyhow, thanks a million for your time with all this, even for just reading out the issue/recommandation!! Let me know if I can be of any help (testing, etc), even if I'm just learning it all right now ;) UPDATE: just a quick note regarding transactions in Mongo, because I searched quite a bit for this one - Transactions will not work with standalone servers! You absolutely need to convert standalone servers to a replicaset (even if he's alone!) in order to have transactions work. Refs.: Cheers! Pat |
Hello,
This would be more of an enhancement suggestion, but thought it be worth documenting here (not sure where else?)
It seems that the current version of the extension doesn't allow to use transactions. From my readings we need to attach the session to all operations (inserts, updates, etc.), by passing the session as an argument to operation functions: insertOne, etc.
I am really not sure, but I think this is due to the fact that the extension uses getDB(), which is now deprecated instead of getDatabase().
The latter's getCollection() function seems to return a MongoCollection<Document> object (as opposed to a DBCollection), which in turn, has the operation methods that can receive the client's session (insertOne, etc)...
Now, I am not 100% sure of all this. I am no wiz in neither Mongo, CFML or Java.... But, looking at the issue with a colleague of mine, this is somewhat what we've came up with.
I wish I could just quickly modify the extension for this, but not sure if I'm up to the challenge... yet. lol.
p.s.: here's a code snippet of how I tried to do a basic transaction using the extension (at least, how I thought it should of worked):
Thanks a million for reading this.
Cheers,
Pat
The text was updated successfully, but these errors were encountered: