[DOCS-7494] Comment on: "primer/query.txt" Created: 23/Mar/16  Updated: 08/Dec/16  Resolved: 18/May/16

Status: Closed
Project: Documentation
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Docs Collector User (Inactive) Assignee: Kay Kim (Inactive)
Resolution: Done Votes: 1
Labels: collector-298ba4e7
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

MongoDB 3.3.3, Mongo Java Driver 3.2.2

Location: https://docs.mongodb.org/getting-started/java/query/
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2687.0 Safari/537.36
Referrer: https://www.google.co.il/
Screen Resolution: 1920 x 1200
repo: docs
source: query


Participants:
Days since reply: 7 years, 46 weeks, 2 days ago
Epic Link: docs-primer

 Description   

db.getCollection("restaurants").find().sort(ascending("borough", "address.zipcode"));

Doesn't work on Mongo Java driver 3.2.2, it doesn't recognize the .sort(ascending("")).

Please, review the documentation! It's most of times DOESN'T work or NOT UPDATED!



 Comments   
Comment by Kay Kim (Inactive) [ 29/Mar/16 ]

Oh, actually, they are included in the Prereq section:
https://docs.mongodb.org/getting-started/java/query/#prerequisites

Comment by Kay Kim (Inactive) [ 29/Mar/16 ]

Hi – Thanks for taking the time to file this ticket. The code example on the page work for me.
By any chance, could it be that you have not included the static import statement for the Sorts helper?

import static com.mongodb.client.model.Sorts.*;

The same would go for if you are using the Filters helper. I recognize that we don't give the code sample for these import statements, rather it's just mentioned as a sentence:

Using the static Filters helper(s), you can also specify the query as follows:
... or
Using the static Sorts helper(s), you can also specify the query as follows:

If that is indeed the case, I can update this to include those import statements.

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