[2.1] Added MongoDB session save handler #2031

merged 1 commit into from Sep 14, 2012


None yet
6 participants

jmikola commented Jul 27, 2012

I based the test on the existing DB session save handler, which appears to be a functional test even though it is labeled as a unit test.

This was the first time I came across an options objects, so I added the database name, collection name, and save options in there instead of constructor arguments (as was done in the MongoDB log writer). The Mongo connection itself is still a constructor argument.

I also removed the save path property on the handler class, as that wasn't used at all (in any of the existing handlers). I have reservations about the ini_get() call in open(), and feel all of the handler classes would do well to inject that option, but I'd like to solicit feedback on that before deviating from the existing convention.

Also, it's not clear to me where session ID's are generated. I decided to use the session ID as Mongo's _id field, which implicitly has a unique index. I imagine the DB table might only have a unique index on the ID and session name combination. If that's the case, I may want to change that and let Mongo generate it's own ObjectId for _id and store the session ID in its own document field (so the user can create their own compound, unique index). The common in MongoDB::write() (and the test) explains my concern.

This pull request passes (merged ac263790 into 06fd0cf).


b-durand commented Jul 28, 2012

Good idea, we need more powerful backends for meetings that the file system. I coun't wait add redis support 😊 👍


weierophinney commented Jul 30, 2012

Updated title to reference 2.1, as we're in feature-freeze mode for 2.0-stable currently.


Maks3w commented Aug 6, 2012


We have renamed the folder for tests from Zend to ZendTest.

Can you rebase your PR to catch this change?

Thanks in advance.

This pull request passes (merged 5329b36 into 2a926c8).


prolic commented Sep 4, 2012

Great job, looks good to me.

@weierophinney weierophinney added a commit that referenced this pull request Sep 14, 2012

@weierophinney weierophinney Merge branch 'mongodb-session' of https://github.com/jmikola/zf2 into…
… feature/session-mongo

PR #2031

weierophinney merged commit 5329b36 into zendframework:master Sep 14, 2012

1 check passed

default The Travis build passed

@weierophinney weierophinney added a commit to zendframework/zend-session that referenced this pull request May 15, 2015

@weierophinney weierophinney Merge branch 'mongodb-session' of https://github.com/jmikola/zf2 into…
… feature/session-mongo

PR zendframework/zendframework#2031
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment