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

Make Document.get_collection public #1182

Open
warvariuc opened this issue Dec 8, 2015 · 3 comments
Open

Make Document.get_collection public #1182

warvariuc opened this issue Dec 8, 2015 · 3 comments
Assignees

Comments

@warvariuc
Copy link

@warvariuc warvariuc commented Dec 8, 2015

Document._get_collection is a protected method, but it's very useful for public usage. I don't see any reason why it should be protected.
I guess this would suffice:

class Document(BaseDocument):
    ...
    get_collection = _get_collection
@wojcikstefan
Copy link
Member

@wojcikstefan wojcikstefan commented Dec 28, 2016

That's a good point. I use Document._get_collection quite a lot myself whenever I need access to raw PyMongo Collection methods.

@wojcikstefan wojcikstefan self-assigned this Dec 28, 2016
@mindojo-victor
Copy link
Contributor

@mindojo-victor mindojo-victor commented Jan 27, 2017

How are you going to name it? Will it be a property collection?

@wojcikstefan
Copy link
Member

@wojcikstefan wojcikstefan commented Feb 15, 2017

collection property sounds like the best choice, though I haven't fully considered all the implications.

No matter what public property we choose, we should make sure that users can't use it as a field name, e.g. this should raise an error immediately upon definition:

class DbDoc(Document):
    collection = StringField()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.