I am using Mongoose.js 4.11.6 Node.js 6.0.
I have a user document which looks like bellow -
var UserSchema = new Schema({
name: { type: String, default: '' },
email: { type: String, default: '' },
phone: { type: String, default: '' },
hashed_password: { type: String, default: '' },
role: { type: String, default: '' },
created_at: { type: Date, default: Date.now }
});
I am running following mongoose query -
UserSchema.find({ role: options.role }) .select(options.select) .sort({ 'email': -1 }) .exec(cb);
Ideally this should return the list matching user sorted by email id. The query works exactly what it is expected to do in our AWS deployment. But in the Cosmos DB MongoDB hosting it is returning the empty resultset. But the query return results (but not in desired order) when the .sort({ 'email': -1 }) is removed.
'-email'as sort parameter?