-
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
Database discovery isn't documented nor working correctly #6
Comments
How did you connect? The expected behavior is that Mongo-Thingy will only try to "guess" the database name (based on the class name construct) if it doesn't already have a database registered for that thingy. |
The thing is: If I have a class SynchronisedSwimming I want to access the collection 'synchronised_swimming'. But because of the CamelCase the collection used is 'swimming' instead. That's my point the 'guessing' part is not in the documentation. |
Please answer my question. If you'd have been connected to a database in the first place, it shouldn't have tried to guess the database, and should have used "synchronised_swimming" as the collection name. If it did not, this is not just a documentation problem, but a bug. |
Well, looks like it's not the case. Here what happened: class SynchronisedSwimming(Thingy):
pass And it connected to the "synchronised" Database with the "swimming" collection I then tried class SynchronisedSwimming(Thingy):
database_name = "sport" And it connected to the "sport" Database with the "swimming" collection I then tried class SynchronisedSwimming(Thingy):
collection_name = "synchronised_swimming"
database_name = "sport" And it connected to the "sport" Database with the "synchronised_swimming" collection I thought that by specifying the database the collection name would not be implied but it is not the case. I'm using mongo-thingy 0.7.0 by the way. Maybe I should have selected the database properly during the connect part ? |
The second example is definitely a bug. For the first example, did you use |
I think the answer is yes: @ramnes I used something like def init():
config = app.config.get_namespace("MONGO_")
connect(**config) And I set the env like so:
|
So the first example in your previous comment is a bug too. I guess there some work needed in Thingy too, so I've opened Refty/thingy#6. |
Hey @guilbep, Code is fixed and released; all your examples should work now! The documentation part will come when we'll have a real one on RTFD. Thanks for the bug report. |
For instance:
If I have a database sport with a collection synchronised_swimming and I name the class
I have to specify the database; if not it will use the synchronised database which does not make sense in that context.
The text was updated successfully, but these errors were encountered: