Skip to content

Revised README #222

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

Merged
merged 7 commits into from
Jan 30, 2025
Merged

Revised README #222

merged 7 commits into from
Jan 30, 2025

Conversation

Jibola
Copy link
Contributor

@Jibola Jibola commented Jan 17, 2025

README containing a few directives.

  • How to install
  • Quickstart
  • Capabilities
  • Issues & Help

@Jibola Jibola marked this pull request as draft January 17, 2025 05:34
@timgraham
Copy link
Collaborator

I envisioned a README similar to Django's and moving most of the other content to docs/.

@aclark4life
Copy link
Collaborator

I envisioned a README with less than 50 lines 😄 The only reason to say more is if we're catering to a non-Django audience (which we are). But I wouldn't say it here, I would link to the quick start.

Django MongoDB Backend

Installation

Note

Django is a dependency of Django MongoDB Backend and will be installed along with Django MongoDB Backend.

pip install django-mongodb-backend

Usage

Create project

django-admin startproject mysite --template \
    https://github.com/mongodb-labs/django-mongodb-project/archive/refs/heads/5.0.x.zip

Run server

Note

MongoDB should be running locally before you start Django.

python manage.py runserver

Open Django

Now open http://127.0.0.1:8000!

Screenshot 2025-01-17 at 9 26 06 AM

README.md Outdated

- Support ArrayFields containing Embedded Models
- Support Collections with multiple Django Models
- Possible support for additional Django fields such as ImageField
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ImageField works fine

README.md Outdated

class MongoAdminConfig(AdminConfig):
default_auto_field = "django_mongodb_backend.fields.ObjectIdAutoField"
This tutorial shows you how to create a Django project, connect to a MongoDB cluster hosted on MongoDB Atlas, and interact with data in your cluster. To read more, please check our MongoDB Backend for Django tutorials page.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't call this a tutorial (it's too short and not very detailed).
Please wrap lines at 80 characters.
This project is called "Django MongoDB Backend" not "MongoDB Backend for Django".
Where is the tutorials page?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, removing that language outright.

README.md Outdated

Alternatively, you can use the following `startapp` template which includes
this change:
Where `<CONNECTION_STRING_URI>` is your connection string from the previous step.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What previous step?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed

README.md Outdated

### Specifying the default primary key field
### Resources
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't think "Resources" fits as a subheading of "Install"

README.md Outdated
@@ -4,247 +4,148 @@ This backend is currently in development and is not advised for Production workf
changes may be made without notice. We welcome your feedback as we continue to
explore and build. The best way to share this is via our [MongoDB Community Forum](https://www.mongodb.com/community/forums/tag/python)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing period

README.md Outdated

The development version of this package supports Django 5.0.x. To install it:

`pip install git+https://github.com/mongodb-labs/django-mongodb-backend`
`pip install django-mongodb-backend`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Proposed text:

Use the version of django-mongodb-backend that corresponds to your version of
Django. For example, to get the latest compatible release for Django 5.0.x:

`pip install --pre django-mongodb-backend==5.2.*`

(Until the package is out of beta, you must use pip's `--pre` option.)

README.md Outdated

In your Django settings, you must specify that all models should use
`ObjectIdAutoField`.
Check back soon as we aim to provide more links that will dive deeper into our library!
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't think the readme would be the place to check. How about a pointer to the documentation instead? (not here, probably)

README.md Outdated

### Configuring migrations
### Connect to the Database
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"database" (not a proper noun)

README.md Outdated

- Querying API powered through the amazing MongoDB Aggregation Pipeline
- Supports most functions of the Django QuerySet API
- Support Query Annotations and common SQL AGGREGATE operators
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are "Query Annotations"? What does it mean to support SQL aggregate operators on MongoDB? I guess you mean QuerySet.annotate() and QuerySet.aggregate()... you already said most of the QuerySet API is supported....

README.md Outdated
#### `django_mongodb_backend.parse_uri(uri, conn_max_age=0, test=None)`
- **Management Commands**

- Use commands like `migrate`, `makemigrations`, `flush`, `sqlmigrate`, many more.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You already mentioned support for schema management. I don't think management commands need a special callout. Particularly not flush.

README.md Outdated
- **Model MongoDB Documents Through Django’s ORM**

- Translate Django model instances to MongoDB documents.
- Create new collections corresponding to models.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This point is duplicated by "Supports core migration functionalities" below.

README.md Outdated

- Translate Django model instances to MongoDB documents.
- Create new collections corresponding to models.
- Supports field validation, data storage, updating, and deletion.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"data storage, updating, and deletion" Is this taking about models again? Is "field validation" talking about Django's form validation?

README.md Outdated
`mongodb://` prefix is never required.
- **Model MongoDB Documents Through Django’s ORM**

- Translate Django model instances to MongoDB documents.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Translate is a strange work. How about "Store Django model instances as MongoDB documents."?

README.md Outdated

- **Unavailable Fields**:
- `GeneratedField`
- `ImageField`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ImageField is supported

README.md Outdated
- **Django Management Commands that do not work**
- `createcachetable`
- `inspectdb`
- `optimizemigration`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

optimizemigration works (has nothing to do with the database backend)

README.md Outdated
- `inspectdb`
- `optimizemigration`
- `sqlflush`
- `sqlsequencereset`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sqlsequencereset is not applicable since this backend doesn't support AutoField.

README.md Outdated
Check back soon as we aim to provide more links that will dive deeper into our library!

* [Developer Notes](DEV_NOTES.md)
`pip install django-mongodb-backend~=5.0.0`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't believe this works (or is what we want people to use). Did you see the version I proposed?

$ pip install django-mongodb-backend~=5.0.0
ERROR: Could not find a version that satisfies the requirement django-mongodb-backend~=5.0.0 (from versions: 5.0.0a1, 5.0.0a2, 5.0.0a3)

[notice] A new release of pip is available: 24.3.1 -> 25.0
[notice] To update, run: pip install --upgrade pip
ERROR: No matching distribution found for django-mongodb-backend~=5.0.0

Copy link
Collaborator

@aclark4life aclark4life Jan 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/~=/==/

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hadn't seen all the comments yet. Reviewing everything now and applying appropriate changes.

README.md Outdated
- Supports most functions of the Django QuerySet API
- Support Query Annotations and common SQL AGGREGATE operators
- We support foreign keys and execute JOIN operations all in 1 database call
- Through our custom raw\_aggregate call, MQL operations like Vector Search, Atlas Search, and GeoSpatial querying still yield Django QuerySet results\!
Support foreign key usage and execute JOIN operations
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think "Supports" is the verb tense to use. Dash was inadvertently deleted. Add period.

README.md Outdated
- **Management Commands**

- Use commands like `migrate`, `makemigrations`, `flush`, `sqlmigrate`, many more.
- Database Variables `ATOMIC_REQUESTS`, `AUTOCOMMIT`, `CONN_HEALTH_CHECKS`, `TIME_ZONE` not supported
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

variables -> settings
add period.
"are not"

README.md Outdated

- Use commands like `migrate`, `makemigrations`, `flush`, `sqlmigrate`, many more.
- Database Variables `ATOMIC_REQUESTS`, `AUTOCOMMIT`, `CONN_HEALTH_CHECKS`, `TIME_ZONE` not supported
- No support for GeoDjango
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"is not supported."

README.md Outdated
- Use commands like `migrate`, `makemigrations`, `flush`, `sqlmigrate`, many more.
- Database Variables `ATOMIC_REQUESTS`, `AUTOCOMMIT`, `CONN_HEALTH_CHECKS`, `TIME_ZONE` not supported
- No support for GeoDjango
- Functions such as `Chr`, `ExtractQuarter`, `MD5`, `Now`, `Ord`, `Pad`, `Repeat`, `Reverse`, `Right`, `SHA1`, `SHA224`, `SHA256`, `SHA384`, `SHA512`, and `Sign`.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Database functions ... are not supported.

README.md Outdated
- No support for GeoDjango
- Functions such as `Chr`, `ExtractQuarter`, `MD5`, `Now`, `Ord`, `Pad`, `Repeat`, `Reverse`, `Right`, `SHA1`, `SHA224`, `SHA256`, `SHA384`, `SHA512`, and `Sign`.
- The `tzinfo` parameter of the `Trunc` database functions does not work properly because MongoDB converts the result back to UTC.
- Schema Validation is not enforced. Refer to MongoDB documentation for how to enforce schema validation.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nobody said it was supported. Give a more helpful pointer if this really needs to be said?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nobody said it was supported. Give a more helpful pointer if this really needs to be said?

I'd definitely prefer linking to unsupported features rather than listing them here.

README.md Outdated
@@ -89,10 +76,64 @@ Then, visit http://127.0.0.1:8000/. This page displays a "Congratulations!" mess
- Fully integrated with Django's authentication framework.
- Supports native user management features like creating users and sessions.

## Limitations of django-mongodb-backend
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Django MongoDB Backend"

Copy link
Collaborator

@aclark4life aclark4life left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aren't we moving the contents of DEV_NOTES.md to Sphinx. I'd suggest we don't start adding additional Markdown files unless there is a precedent to do so. E.g. CONTRIBUTING.md

@timgraham
Copy link
Collaborator

Aren't we moving the contents of DEV_NOTES.md to Sphinx. I'd suggest we don't start adding additional Markdown files unless there is a precedent to do so. E.g. CONTRIBUTING.md

That's my plan. Not going to worry about it for this PR. Think the plan changed since those comments in the PR description was written.

README.md Outdated
this change:
From your shell, run the following command to create a new Django project
called example based on a custom template. Make sure the version referenced
from `django-mongodb-labs` corresponds to your version of Django similar
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guss you meant "django-mongodb-project" but I'm not quite sure what "from ...." means. I would kind of understand if it said "after" although there is some other stuff between that text and the version number.

I'm not sure referencing the install stage is completely clear. The instruction use "5.0.*" there. I thought what I wrote before - referencing "5.0" specifically - make it clear that the "x" does not need to be changed.

Copy link
Contributor Author

@Jibola Jibola Jan 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went ahead and rewrote it to explain that we have a custom template and then explicitly stated that 5.0.x.zip is the thing to pay attention to.

@Jibola Jibola marked this pull request as ready for review January 30, 2025 00:21
@Jibola Jibola merged commit 4eb75cd into main Jan 30, 2025
14 checks passed
@Jibola Jibola deleted the revised-readme branch January 30, 2025 00:52
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

Successfully merging this pull request may close these issues.

3 participants