gamontal / mongolab-data-api

⚠️ This repository is no longer maintained.
MIT License
7 stars 5 forks source link

Documentation wrong on .listDocument sortOrder parameter #1

Closed matijaabicic closed 8 years ago

matijaabicic commented 8 years ago

sortOrder optional parameter is listed as Object type, it should be string, same as query.

This doesn't work:

var queryOptions = {
      "database"        : settings.mongoDBName,
      "collectionName"  : "my_collection",
      "query"           : '{"result_type" : "exact"}',
      "limit"           : 1,
      "sortOrder"       : {"datetime":-1}
    };

this works:

var queryOptions = {
      "database"        : settings.mongoDBName,
      "collectionName"  : "phrases",
      "query"           : '{"result_type" : "exact"}',
      "limit"           : 1,
      "sortOrder"       : '{"datetime":-1}'
    };

Diff: '{"datetime":-1}' vs. {"datetime":-1}

gamontal commented 8 years ago

You're right. Thanks :+1: