I think the issue is how you're doing the projection. Find in MongoDB uses the following syntax.
db.collection.find( <query>, <projection>, <options> )
Where <query> is the equivalent of the Where directive in SQL, and <projection> is the list of fields to be returned. So what you want is something like this:
RecurringType = rc.db.RecurringType
.find(
{}, // no filtering
{_id : 0} // return all except the id
)
.sort({ "SortOrder" : 1 }) // sort by SortOrder ascending
.toArray(); // convert the object to an array of structs.
Please note I haven't directly tested this, but here's an example I know that works:
var isoDate = DateTimeFormat(parseDateTime(arguments.deltaDate), "iso"); // convert the last change argument to an isoformat.
var filter = { "lastChange": { "$gte": { "$date": isoDate } } } ;
// Specifies selection filter using query operators.
// To return all documents in a collection, omit this parameter
// or pass an empty document ({}).
var projection = {"_id": 0}; // don't include the _id in the returned
// Specifies the fields to return in the documents that match the query filter.
var seasons = db.seasons.find(
filter,
projection
)
.sort({creationDate: -1}) // sort by creation date, newest first
.toArray(); // use the built in toArray() method to convert the Mongo cursor results to an array of structs.
HTH.
project()meant to do? I'm not familiar with it as a built-in function, so it seems you'd need to define it. And how is this related to mongodb?QueryMap()might help here, or use a Query of Queries as an intermediate step.