An Array is ['field1', 100, 200]. Key-based is an Object.
If you save an object, with {'field1': 100, 'field200': 200 } it will be saved lexicographically. Kind regards. On 5/2/14, 11:50 PM, Alejandro Paciotti wrote: > Hi > > I have a function that save a document in a mongodb database: > > function *savedata*(name, data, next){ > > var ResultsModel=mongoose.model('Result', > { name:String, > create_at:{type:Date,default:Date.now}, > *data:[]* > }); > > var r=new ResultsModel(); > r.name <http://r.name> = name; > *r.data = data;* > r.save(function(err){ > if(err) throw err; > next(); > }); > } > > > If i call a function with savedata('reportname', *['field1': 100, > 'field2': 200]*, function(err){ console.log('done') }) > > When i want retreive the data, the array is like this: *['field2': 200, > 'field1': 100]* . Perfectly reversed. > > Any idea? > > > > > alejandro.pacio...@gmail.com <mailto:alejandro.pacio...@gmail.com> > > -- > -- > Job Board: http://jobs.nodejs.org/ > Posting guidelines: > https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines > You received this message because you are subscribed to the Google > Groups "nodejs" group. > To post to this group, send email to nodejs@googlegroups.com > To unsubscribe from this group, send email to > nodejs+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/nodejs?hl=en?hl=en > > --- > You received this message because you are subscribed to the Google > Groups "nodejs" group. > To unsubscribe from this group and stop receiving emails from it, send > an email to nodejs+unsubscr...@googlegroups.com > <mailto:nodejs+unsubscr...@googlegroups.com>. > For more options, visit https://groups.google.com/d/optout. -- Jose Luis Rivas - http://joseluisrivas.net Venezuela - GPG: 0xB9AC8C43 -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.