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

Check, fix and update examples #216

Open
IlyaSkriblovsky opened this issue Sep 11, 2017 · 8 comments
Open

Check, fix and update examples #216

IlyaSkriblovsky opened this issue Sep 11, 2017 · 8 comments

Comments

@IlyaSkriblovsky
Copy link
Contributor

IlyaSkriblovsky commented Sep 11, 2017

Unfortunately, many of our examples are of bad quality.

  • Some examples simply not working due to errors in the example code
  • Some are confusingly overengineered
  • Some treat Connection and ConnectionPool like Deferreds which may confuse readers
  • Almost all of them use the old CRUD API
  • Many are py3-incompatible

We need short, consice, practical (and working!) examples to simplify onboarding of new users!

(see #215)

@trenton42
Copy link
Contributor

Yes yes yes! I would like to help with this. Out of curiosity, I went over to the pymongo project to see if they had anything, but they didn't. Do you have a strategy or layout in mind to set these up? It might be helpful if the various examples followed some sort of template to make them easier to navigate and understand.

@IlyaSkriblovsky
Copy link
Contributor Author

I'm not sure what common template do you mean?
I personally prefer very short and concise examples mainly to help with bootstrapping. Longer real-life examples are optional for me.

@trenton42
Copy link
Contributor

Sorry I wasn't clear. I was mainly just thinking about organizing the examples so they could be run the same way and their code was laid out similarly so it would be easier to follow from one example to the next.

@IlyaSkriblovsky
Copy link
Contributor Author

IlyaSkriblovsky commented Sep 11, 2017

Extensive list of possible examples:

  • Single connection, Connection pool
  • Connecting by host/port, by url, with url options
  • Authentication
  • SSL
  • insert, update, replace, remove
  • find, find_one, sorting, iterating with cursor, find_one_and_*
  • Misc collection methods: count, distinct, drop, create_index
  • Misc database methods: command, create_collection, collection_names
  • Bulk ops
  • Write concerns & Codec options
  • GridFS
  • Aggregation
  • Callback-style vs. inlineCallbacks-style
  • A couple of real-life examples: webapp, standalone command line utility
  • May be some useful real-life tricks: optimistic locking, incrementing integer counter, ...

@IlyaSkriblovsky
Copy link
Contributor Author

I hope most of examples won't contain much of boilerplate code, so the common template might only contain an assertion that all examples connect to localhost:27017/test database. May be I'm missing something.

@trenton42
Copy link
Contributor

That is good 👍 I will have a go at writing some examples and send over a PR

@IlyaSkriblovsky
Copy link
Contributor Author

Thanks! I will try to find some time for this too. Please ping me with the topics you are working on when you start to avoid duplicating efforts.

@IlyaSkriblovsky
Copy link
Contributor Author

started to write some connection examples in #217

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants