A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.mongodb.com/docs/languages/python/django-mongodb/current/get-started/query-data/ below:

Query MongoDB Data - Django MongoDB Backend v5.2

You can import your models into the Python interactive shell to read data from the sample_mflix database.

Start a Python shell by running the following command:

Then, run the following code to query the sample_mflix.users collection for a movie viewer whose email is "jason_momoa@gameofthron.es":

from sample_mflix.models import Movie, ViewerViewer.objects.filter(email="jason_momoa@gameofthron.es").first()

This code returns the name of the matching user:

Run the following code to query the sample_mflix.movies collection for movies that have a runtime value less than 10:

Movie.objects.filter(runtime__lt=10)

This code returns a truncated list of the matching movies:

<QuerySet [<Movie: Winsor McCay, the Famous Cartoonist of the N.Y.Herald and His Moving Comics>, <Movie: Steamboat Willie>, <Movie:Three Little Pigs>, <Movie: The Band Concert>, <Movie: Who Killed Cock Robin?>,<Movie: Dots>, <Movie: The Cat Concerto>, <Movie: Begone Dull Care>,<Movie: Mi adorado Juan>, <Movie: Neighbours>, <Movie: A Phantasy>,<Movie: Duck Amuck>, <Movie: Duck Dodgers in the 24èth Century>,<Movie: Blinkity Blank>, <Movie: One Froggy Evening>,<Movie: What's Opera, Doc?>, <Movie: Lines: Horizontal>,<Movie: Il fornaretto di Venezia>, <Movie: Dog Star Man: Part IV>,<Movie: Now>, '...(remaining elements truncated)...']>

After completing this step, you can run queries on data stored in your MongoDB deployment.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4