I'm working through an example that uses mongoose to populate a MongoDB.
var eventSchema = new mongoose.Schema({
_id: { type: String },
name: { type: String, required: true},
description: {type: String},
venue: {type: String}, });
eventSchema.plugin(require('./plugins/pagedFind'));
eventSchema.index({ name: 1 });
eventSchema.index({ date: 1 });
eventSchema.index({ venue: 1 });
I didn't know what schema.index was; so I looked it up; http://mongoosejs.com/docs/guide.html; What I've learned is that it is a way to sort your collection besides the default _id sorting.
But is there any difference between what I've written and the following?
eventSchema.index({ name: 1, date: 1,venue: 1 });