Skip to content

DOCSP-46322: Raw queries #1

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 15 commits into from
Jan 24, 2025

Conversation

norareidy
Copy link
Collaborator

@norareidy norareidy commented Jan 14, 2025

Copy link

netlify bot commented Jan 14, 2025

Deploy Preview for docs-django ready!

Name Link
🔨 Latest commit 80ddf07
🔍 Latest deploy log https://app.netlify.com/sites/docs-django/deploys/67929d51fba5ea0008d290e9
😎 Deploy Preview https://deploy-preview-1--docs-django.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@norareidy norareidy requested a review from R-shubham January 14, 2025 20:41
@norareidy norareidy requested a review from Jibola January 16, 2025 17:31
Copy link
Collaborator

@Jibola Jibola left a comment

Choose a reason for hiding this comment

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

Great work! Added my new suggestions. Let me know what you think. The prose may need some workshopping, though.

Comment on lines +90 to +92
- :ref:`django-raw-queries-filter-group`
- :ref:`django-raw-queries-search`
- :ref:`django-raw-queries-geospatial`
Copy link
Collaborator

Choose a reason for hiding this comment

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

Final addition. Let's add a section here for Exposing the MongoClient. The language is in case someone wants to execute a query completely absent of the Django framework. The way to do that is like this:

from django.db import connections

client = connections["<DATABASES_KEY>"].database.client

This gives the underlying MongoClient Django references when making queries. With this exposed, users have access to MongoDB's full library of functions such as command(), find(), create_index(), create_search_index() and much, much more!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This seems like useful information but I think it's outside the scope of this page - since I orient everything around the raw_aggregate() method, using aggregation pipelines, and I introduce the page that way, I would have to spend some time reworking. Do you think this is necessary for public preview or can I ticket it out for later?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd say we should still push to add this information in somewhere, but it doesn't need to be in raw queries. I figured it would be best for the raw querying section. It doesn't have to be here, but we can discuss if there's another ongoing/yet-to-be-made section where it's sensible to push.

Comment on lines 157 to 160
For instructions on using the PyMongo driver to create an Atlas
Search index, see `Atlas Search and Vector Search Indexes
<https://www.mongodb.com/docs/languages/python/pymongo-driver/current/indexes/atlas-search-index/>`__
in the PyMongo documentation.
Copy link
Collaborator

Choose a reason for hiding this comment

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

As well, add here that you can retrieve the MongoClient object by following the information (I've supplied just now in another comment) and then follow these instructions.

Copy link
Collaborator

@R-shubham R-shubham left a comment

Choose a reason for hiding this comment

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

LGTM

@norareidy norareidy merged commit a6d9814 into mongodb:master Jan 24, 2025
5 checks passed
@norareidy norareidy deleted the DOCSP-46322-raw-queries branch January 24, 2025 14:56
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