The problem is that i use this object (*data*) for charts, where the order
is very important.

In the initial email i wrote without copy & paste, and i think that was a
problem with the configuration, but not. Apparently is a v8 behavior.

I do not understand yet.

Thanks!


[email protected]


2014-05-03 6:22 GMT-03:00 Angel Java Lopez <[email protected]>:

> Ummm... but what is the problem?
>
> You retrieved the array with the elements in the same order, that is, the
> array is the same. The only difference, is that EACH element is an object
> and the property order are mangled. But what is the problem for your
> program?
>
> The initial email described another situation: mangled array. But
> apparently, this is not the case.
>
> Angel "Java" Lopez
> @ajlopez
>
>
>
> On Sat, May 3, 2014 at 3:28 AM, Alejandro Paciotti <
> [email protected]> wrote:
>
>> I send to the function this:
>>
>> [ { Periodo: '2010-08',
>>     Total: 1363371.31,
>>     CobradoSegunContrato: 700741.61,
>>     Cuota_Licitacion: 44565,
>>     Proyectado: 812304.29,
>>     Proximas_Adelantadas: 271622.7,
>>     Ultimas_Adelantadas: 161692 },
>>   { Periodo: '2010-09',
>>     Total: 973838.09,
>>     CobradoSegunContrato: 662753.06,
>>     Cuota_Licitacion: 16241.92,
>>     Proyectado: 514792.1,
>>     Proximas_Adelantadas: 60626.61,
>>     Ultimas_Adelantadas: 126851.5 }]
>>
>> I save like this:
>>
>> {
>>     "name" : "ingresos",
>>     "_id" : ObjectId("53648b1d1579089428dfb8ae"),
>>     "data" : [
>>         {
>>             "Ultimas_Adelantadas" : 161692,
>>             "Proximas_Adelantadas" : 271622.7,
>>             "Proyectado" : 812304.29,
>>             "Cuota_Licitacion" : 44565,
>>             "CobradoSegunContrato" : 700741.61,
>>             "Total" : 1363371.31,
>>             "Periodo" : "2010-08"
>>         },
>>         {
>>             "Ultimas_Adelantadas" : 126851.5,
>>             "Proximas_Adelantadas" : 60626.61,
>>             "Proyectado" : 514792.1,
>>             "Cuota_Licitacion" : 16241.92,
>>             "CobradoSegunContrato" : 662753.0600000001,
>>             "Total" : 973838.09,
>>             "Periodo" : "2010-09"
>>         },
>>
>> etc.. etc..
>>
>> I don't understand.
>>
>> Thanks!
>>
>>
>> [email protected]
>>
>>
>> 2014-05-03 2:59 GMT-03:00 Jose Luis Rivas <[email protected]>:
>>
>> 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?
>>> >
>>> >
>>> >
>>> >
>>> > [email protected] <mailto:[email protected]>
>>> >
>>> > --
>>> > --
>>> > 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 [email protected]
>>> > To unsubscribe from this group, send email to
>>> > [email protected]
>>> > 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 [email protected]
>>> > <mailto:[email protected]>.
>>> > 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 [email protected]
>>> To unsubscribe from this group, send email to
>>> [email protected]
>>> 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 [email protected].
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>  --
>> --
>> 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 [email protected]
>> To unsubscribe from this group, send email to
>> [email protected]
>> 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 [email protected].
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>  --
> --
> 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 [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> 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 [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
-- 
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to