Documents and Collections To specify an order for the results, append the  sort()  method to the  find()  method. Pass to the sort()  method a list of one or more fields to sort by and, optionally, the descending ( desc ) or ascending ( asc ) attribute as appropriate. Ascending order is the default order type. For example, the following query sorts all documents by the IndepYear field and then returns the first eight documents in descending order. By default, the  limit()  method starts from the first document in the collection. You can use the  skip() method to change the starting document. For example, to ignore the first document and return the next eight documents matching the condition, pass to the  skip()  method a value of 1. You can use the  modify()  method to update one or more documents in a collection. The X DevAPI provides additional methods for use with the  modify()  method to: The  modify()  method works by filtering a collection to include only the documents to be modified and then applying the operations that you specify to those documents. In the following example, the  modify()  method uses the search condition to identify the document to change and then the  set()  method replaces two values within the nested demographics object. After you modify a document, use the  find()  method to verify the change. To remove content from a document, use the  modify()  and  unset()  methods. For example, the following query removes the GNP from a document that matches the search condition. Use the  find()  method to verify the change. mysql-js>  db.countryinfo.find().sort(["IndepYear desc"]).limit(8) ... [ output removed ] 8 documents in set (0.00 sec) mysql-js>  db.countryinfo.find().sort(["IndepYear desc"]).limit(8).skip(1) ... [ output removed ] 8 documents in set (0.00 sec) mysql-js>  db.countryinfo.modify("Code = ’SEA’").set( "demographics", {"LifeExpectancy": 78, "Population": 28}) mysql-js>  db.countryinfo.find("Name = ’Sealand’") { "_id": "00005e2ff4af00000000000000f4", "Name": "Sealand", mysql-js>  db.countryinfo.modify("Name = ’Sealand’").unset("GNP") Related Information 20.3.3.4 Modify Documents Set and Unset Document Fields •The MySQL Reference Manual provides detailed documentation on functions and operators. •See CollectionFindFunction for the full syntax definition. •Set and unset fields within documents. •Append, insert, and delete arrays. •Bind, limit, and sort the documents to be modified. 3854