Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion how to get the max of my collection without the _id

Received: by 10.236.73.131 with SMTP id v3mr4089716yhd.6.1337960915356;
        Fri, 25 May 2012 08:48:35 -0700 (PDT)
X-BeenThere: mongodb-user@googlegroups.com
Received: by 10.236.173.229 with SMTP id v65ls2620489yhl.0.gmail; Fri, 25 May
 2012 08:48:21 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.236.157.166 with SMTP id o26mr192589yhk.10.1337960900974; Fri,
 25 May 2012 08:48:20 -0700 (PDT)
Authentication-Results: ls.google.com; spf=pass (google.com: domain of
 dcro...@10gen.com designates internal as permitted sender)
 smtp.mail=dcro...@10gen.com; dkim=pass
 header...@10gen.com
Received: by p16g2000yqc.googlegroups.com with HTTP; Fri, 25 May 2012 08:48:20
 -0700 (PDT)
Date: Fri, 25 May 2012 08:48:20 -0700 (PDT)
In-Reply-To: <4e2b4262-b147-4b8f-8bf0-8da45dfabe5e@googlegroups.com>
References: <65cab5f7-516e-494b-bd05-fbcbb9c59a54@5g2000vbf.googlegroups.com>
 <6c7c4f76-2b44-4fc2-b424-d5fcf96f1a6b@googlegroups.com> <CALKyTE6pesYpQJXFOdmpNYgauxMT553P0tkidBjh=9JD_JdYnQ@mail.gmail.com>
 <288c18fc-ffab-4447-97f3-75f7613e92e4@googlegroups.com> <CALKyTE7_+EC8M5Ka51-n-Q+M9itNncEJU8BQ6e0CfGvSB9hyDQ@mail.gmail.com>
 <c2818b9a-24a9-4968-87bb-52586379e354@googlegroups.com> <CALKyTE6LaE61zcvg9o5kmd0NJn2jMPNsb4t-xzJuxG+_MmPO8Q@mail.gmail.com>
 <CALKyTE7DGRhZBOKhLC9BZhYq0vVN_T6ySDZKvE7m3JRg0bHJ=g@mail.gmail.com>
 <CALKyTE6XLf_v2Z3vM=0rFOB3d2gvv881=Ny1dUBDWmw8DM9Vhw@mail.gmail.com> <4e2b4262-b147-4b8f-8bf0-8da45dfabe5e@googlegroups.com>
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4)
 AppleWebKit/534.57.2 (KHTML, like Gecko) Version/5.1.7 Safari/534.57.2,gzip(gfe)
Message-ID: <b12d225b-1404-466a-84b1-23da8bcc02ed@p16g2000yqc.googlegroups.com>
Subject: Re: how to get the max of my collection without the _id
From: Dan Crosta <dcro...@10gen.com>
To: mongodb-user <mongodb-user@googlegroups.com>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

You can store the date into a variable using something like:

    var start =3D new Date()
    /* do some stuff */
    var end =3D new Date()
    print("took " + ((end - start) / 1000) + " seconds");

If you are comparing performance, you may also want to compare against
map-reduce and the aggregation framework. This particular algorithm
(finding the max or min value within a group) can be implemented in
all 3 approaches.

- Dan

On May 25, 11:38=A0am, MANU <briot.man...@gmail.com> wrote:
> for the moment I'm currently in the console.
>
> My objective is to compare performance query compare to Oracle's query
> GROUP BY.
>
> So my second step will be putting my mongo code into a js script and
> analyse the time spent.
>
> Is it possible to write into a file in javascript in order to store the