Skip to content

Commit

Permalink
linter fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Jibola committed Jan 29, 2025
1 parent 846c98f commit 6efce63
Showing 1 changed file with 34 additions and 42 deletions.
76 changes: 34 additions & 42 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,27 @@
# Django MongoDB Backend



This backend is currently in development and is not advised for Production workflows. Backwards incompatible
This backend is currently in development and is not advised for production workflows. Backwards incompatible
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).

## Install

Use the version of django-mongodb-backend that corresponds to your version of
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.0.*`

```bash
$ pip install --pre django-mongodb-backend==5.0.*
```
(Until the package is out of beta, you must use pip's `--pre` option.)


## Quickstart

### Start Project
### Start project

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
to the install stage. For example, this command works for Django 5.0.x:
called `example` based on a custom template. Make sure the zipfile referenced
at the end of the template link corresponds to your
version of Django. This snippet useso get the latest compatible release for Django 5.0.x:

```bash
$ django-admin startproject example --template https://github.com/mongodb-labs/django-mongodb-project/archive/refs/heads/5.0.x.zip
Expand All @@ -32,63 +30,57 @@ $ django-admin startproject example --template https://github.com/mongodb-labs/d

### Connect to the database

Navigate to your `example/settings.py` file and find the variable named `DATABASES` Replace the `DATABASES` setting with this:
Navigate to your `example/settings.py` file and find the variable named
`DATABASES` Replace the `DATABASES` variable with this:

```python
DATABASES = {
"default": django_mongodb_backend.parse_uri("<CONNECTION_STRING_URI>"),
"default": django_mongodb_backend.parse_uri("<CONNECTION_STRING_URI>"),
}
```

> The MongoDB connection string must also specify a database for the parse_uri function.
> If not already included, make sure you provide a value for `<DATABASE_NAME>`
> in your URI as shown in the example below:
> `mongodb+srv://myDatabaseUser:D1fficultP%[email protected]/<DATABASE_NAME>?retryWrites=true&w=majority`
The MongoDB `<CONNECTION_STRING_URI>` must also specify a database for the
`parse_uri` function to work.
If not already included, make sure you provide a value for `<DATABASE_NAME>`
in your URI as shown in the example below:
```bash
mongodb+srv://myDatabaseUser:D1fficultP%[email protected]/<DATABASE_NAME>?retryWrites=true&w=majority
```


### Run the Server
### Run the server
To verify that you installed Django MongoDB Backend and correctly configured your project, run the following command from your project root:
```bash
python manage.py runserver
$ python manage.py runserver
```
Then, visit http://127.0.0.1:8000/. This page displays a "Congratulations!" message and an image of a rocket.


## Capabilties for Django MongoDB Backend
## Capabilities of Django MongoDB Backend

- **Model MongoDB Documents Through Django’s ORM**

- **Model MongoDB Documents Through Django’s ORM**

- Store Django model instances as MongoDB documents.
- Supports field validation, data storage, updating, and deletion.
- Maps Django's built-in fields to MongoDB data types.
- Provides custom fields for arrays (`ArrayField`) and embedded documents (`EmbeddedModelField`).
- Maps Django's built-in fields to MongoDB data types.
- Provides custom fields for arrays (`ArrayField`) and embedded documents (`EmbeddedModelField`).
- Supports core migration functionalities.


- **Index Management**
- **Index Management**
- Create single, compound, partial, and unique indexes using Django Indexes.

- **Querying Data**

- **Querying Data**
- Supports most of the Django QuerySet API.
- Supports foreign key usage and executes JOIN operations.
- A custom `QuerySet.raw_aggregate` method allows MQL operations like Vector Search, Atlas Search, and GeoSpatial querying to yield Django QuerySet results.


- **Administrator Dashboard & Authentication**

- Supports relational field usage and executes `JOIN` operations with MQL.
- A custom `QuerySet.raw_aggregate` method exposes MongoDB-specific operations like Vector Search, Atlas Search, and GeoSpatial querying to yield Django QuerySet results.
- **Administrator Dashboard & Authentication**
- Manage your data in Django’s admin site.
- Fully integrated with Django's authentication framework.
- Supports native user management features like creating users and sessions.
- Supports native user management features like creating users and session management.

<!-- ## Known issues and limitations
Check out our MongoDB Docs on library limitations here!
-->

### Issues & Help

We're glad to have such a vibrant community of users of Django MongoDB Backend. We recommend seeking support for general questions through the [MongoDB Community Forums](https://www.mongodb.com/community/forums/tag/python).


#### Bugs / Feature Requests
To report a bug or to request a new feature in Django MongoDB Backend, please open an issue in JIRA, our issue-management tool, using the following steps:

Expand All @@ -100,4 +92,4 @@ To report a bug or to request a new feature in Django MongoDB Backend, please op

Bug reports in JIRA for the Django MongoDB Backend project can be viewed by everyone.

If you identify a security vulnerability in the driver or in any other MongoDB project, please report it according to the instructions found in [Create a Vulnerability Report](https://www.mongodb.com/docs/manual/tutorial/create-a-vulnerability-report/).
If you identify a security vulnerability in the driver or in any other MongoDB project, please report it according to the instructions found in [Create a Vulnerability Report](https://www.mongodb.com/docs/manual/tutorial/create-a-vulnerability-report/).

0 comments on commit 6efce63

Please sign in to comment.