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
Mongo driver refactoring #171
Conversation
1) vibe.db.mongo.db -> vibe.db.mongo.client MongoDB -> MongoClient MongoClient is cleaned up from all database specific features MongoClient.opIndex removed MongoClient.getDB added 2) Created new module vibe.db.mongo.db Created MongoDatabase class All database service functions moved to MongoDatabase 3) Most vibe.db.mongo.connection stuff is marked as /// private All vibe.db.mongo.connection symbols intended for user code usage are documented 4) getLastError() root implementation is now in MongoConnection getLastError() implementation fixed getLastError() now return immutable POD struct: MongoErrorDescripion checkLastError() now uses getLastError() 5) MongoHost class -> struct 6) MongoClient now only uses MongoClientSettings in constructor 7) MongoCollection stores MongoDatabase instead on plain name string 8) MongoDatabase basic implementation with old service methods: getLastError, getLog, fsync 9) MongoDatabase.runCommand is package instead of public for better encapsulation Enhancments: 1) Added MongoDriverException and MongoDBException All mongo driver code now throws one of those MongoDBException encapsulated MongoErrorDescripion 2) MongoCollection.remove() overload added
1) opIndex for MongoDatabase
Also main site docs need to be updated. Will add related pull request later. |
Also please note answer in newsgroup regarding possible CI and functional / sanity tests. |
doc["name"] = indexname.data; | ||
if( flags & IndexFlags.Unique ) doc["unique"] = true; | ||
if( flags & IndexFlags.DropDuplicates ) doc["dropDups"] = true; | ||
if( flags & IndexFlags.Background ) doc["background"] = true; | ||
if( flags & IndexFlags.Sparse ) doc["sparse"] = true; | ||
m_db[databaseName ~ ".system.indexes"].insert(doc); | ||
m_client.getCollection(database.name ~ ".system.indexes").insert(doc); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
m_db["system.indexes"].insert(doc)
?
Great, that was fast ;)
|
Will address comments soon today.
|
Maybe regarding 1., it would make sense to introduce another DDOC thing that marks an entity as internal? Then it could be filtered out or displayed with a red "internal" badge. Generally, my approach is to document everything that is interesting for development - be it pure application development or developing the library itself. Filtering can then be done when generating the docs (i.e. another alternative in this case would be to filter out the whole For the DB<->Database thing, at least the module should be named accordingly. Regarding |
"to introduce another DDOC thing that marks an entity as internal?" - awesome, that will solve this problem nicely. Is it a big effort to add one? I must admit initially I have marked all vibe.db.mongo.connection as
|
It should be quite quick tp add. One question would be which syntax to use. An alternative using macros: I'm leaning towards the first variant in favor of readability (a credo of DDOC that is taken ad adsurdum in many parts of the Phobos docs already)... |
Hm a thrid option would be another special section:
Has the drawback that it is a bit more tedious to implement |
I will use any solution implemented :) Final documentation quality is what more important to me and I doubt someone will use DDOC instead of DDOX for vibed.org doc generation. |
One argument in favor of 3d, more difficult solution is that it allows to do a normal good documentation for everything and easily control final target output via tag combination. I.e. make special developer documentation with private and internal symbols included and still with all good info. |
@s-ludwig |
Unfortunately not yet really. There are some beginnings in an internal wiki though. I will put them on the github wiki as soon as they are a bit more finalized. But yeah, it's tabs for indentation. That was somthing I forgot to ask, since github converts anything to spaces I couldn't tell. |
OK, all but Awaiting for your resolution with new DDOX keyword. |
Okay, lets just go with the Regarding the tag name itself |
Changes some stuff to use new tag. Leaving up to you to chose which symbols should be [private] and which [internal], though, it is hard to decide when you are not a class author. |
|
Oh, I am so bad then :) Was sure it was added to hide public symbols for ddoc generation. |
Ok I thing I got this right finally ;) |
Ok, looks ready to merge. I'll do that and then go fix all of my projects. Any possible fixes can still be made later. |
Wow, it was much faster and much easier than I have expected. Current pull request status: basic changes, "works for me". Probably some enhancement commit will be added if review will take some time, otherwise those will go as separate ones.
Changes copied from git log: