var query = new AV.Query('_User'); query.find() .then(function(results) { // Retrieve all user information console.log(results); }) .catch(function(error) { console.error(error); });
var query = new AV.Query('Product'); query.descending('sales'); query.limit(5); query.select('name'); query.find() .then(function(results) { // Retrieve top 5 product names console.log(results); }) .catch(function(error) { console.error(error); });In this code snippet, the `AV.Query()` method is used to create a new query object that specifies the data class `Product`. The `descending()` method is called on the query object to sort the results by the `sales` attribute in descending order. The `limit()` method is called to retrieve only the top 5 results. The `select()` method is called to retrieve only the `name` attribute for each result. Package library: leanengine-sdk-js. This is the official JavaScript SDK for the Leancloud service, which enables developers to easily access and manipulate data stored in the cloud. The `AV.Query()` method is part of this package library.