MongoDB date index

Viewed 1013

I am using node.js and mongodb for my small application and I want to index my document by date object. For Example

var MySchema = new Schema({
    created_at: { type: Date, default: Date.now }
});

myschema.index({created_at: -1});

But how I understand, each object will have nearly unique create_id field. Wouldit work well ? and would this method give me effect. If you can, please also send me any articles about mongodb date indexing.

0 Answers
Related