javascript - Mongoose: retrieve data in same order as schema -


is there way retrieve mongoose db info in same order appears in schema?

it seems group type when returns 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 write file information in specific order appears in schema if possible retrieve in order save lot of code.

if isn't possible, possible retrieve schema grab keys in order can match them when writing file?

you have use array.

an object member of type object. unordered collection of properties each of contains primitive value, object, or function. function stored in property of object called method.

http://www.ecma-international.org/publications/files/ecma-st-arch/ecma-262,%203rd%20edition,%20december%201999.pdf


Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -