[DOCS-7130] Query page has minor error Created: 10/Feb/16  Updated: 11/Jan/17  Resolved: 06/May/16

Status: Closed
Project: Documentation
Component/s: manual, primer
Affects Version/s: mongodb-3.2
Fix Version/s: 01112017-cleanup

Type: Bug Priority: Trivial - P5
Reporter: Need Py Mongo Help Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:
Days since reply: 8 years, 1 week, 1 day ago

 Description   

Page: https://docs.mongodb.org/getting-started/python/query/

Zipcode is sorted in DESCENDING order but description notes that it sorts in ASCENDING order.

To sort by multiple keys, pass a list of keys and sort type pairs. For example, the following operation returns all documents in the restaurants collection, sorted first by the borough field in ascending order, and then, within each borough, by the "address.zipcode" field in ascending order:

import pymongo
cursor = db.restaurants.find().sort([
("borough", pymongo.ASCENDING),
("address.zipcode", pymongo.DESCENDING)
])


Generated at Thu Feb 08 07:53:38 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.