These are chat archives for Automattic/mongoose

Dec 2016
Sravan S
Dec 20 2016 01:26
Hi guys, I have a query
var transferSchema = new mongoose.Schema({ followerId: { type: String, required: true }, name: { type: String, required: true }, transferDate: { type: Date, default:, required: true }, transferIssuedby: { type: String, required: true }, remarks: { type: String } });
Sravan S
Dec 20 2016 01:33
This is a schema that I have. Whenever I go transferSchema.find({}) , it returns all documents in a FIFO order . Is there any thing that I can do to get all this data sorted in a LIFO order, without including something like _entrydate
By FIFO, I mean entry that was inserted first will come out first
Erinç Fırtına
Dec 20 2016 10:14
@sravan-s sort by _id
transferSchema.find({}).sort({_id: -1})
Dec 20 2016 21:58
is indexing various fields not recommended?
let's say I have a collection of posts, each post has (among other props) a category and a slug
these are the primary ways to look for and sort said posts
so, do I need to put index: true in the Schema for both of em?
Is it correct or any good?