Is there a way to retrieve my mongoose db info in the same order that it appears in the schema?
It seems to group by type when it returns the objects.
example:
//schema
var data = {
element1 : String,
element2 : Number,
element3 : Array,
element4 : Number,
}
//.find() returns
var data = {
element1 : String,
element2 : Number,
element4 : Number,
element3 : Array,
}
I need to write a file with the information in the specific order that it appears in the schema so if it is possible to retrieve it in that order it will save a lot of code.
If that isn't possible, is it possible to retrieve the schema to grab the keys in order so that I can match them up when writing the file?