Received: by 10.236.78.232 with SMTP id g68mr11165542yhe.3.1349635718131; Sun, 07 Oct 2012 11:48:38 -0700 (PDT) X-BeenThere: mongodb-user@googlegroups.com Received: by 10.236.149.34 with SMTP id w22ls7998188yhj.8.gmail; Sun, 07 Oct 2012 11:48:26 -0700 (PDT) Received: by 10.236.115.33 with SMTP id d21mr1569100yhh.12.1349635706302; Sun, 07 Oct 2012 11:48:26 -0700 (PDT) Date: Sun, 7 Oct 2012 11:48:25 -0700 (PDT) From: Tad Marshall To: mongodb-user@googlegroups.com Message-Id: <0c1736be-bb0e-4b0c-86ff-c8602a2a54dc@googlegroups.com> In-Reply-To: <76a47197-70ab-4004-9dc6-285b554c6e42@googlegroups.com> References: <76a47197-70ab-4004-9dc6-285b554c6e42@googlegroups.com> Subject: Re: new ObjectId().toString() returning different results in 2.2 than 2.0.7 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_460_24371337.1349635705678" ------=_Part_460_24371337.1349635705678 Content-Type: multipart/alternative; boundary="----=_Part_461_10110513.1349635705678" ------=_Part_461_10110513.1349635705678 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Yes, this was a breaking change and should have been flagged in the release notes. Using the "str" property of ObjectId() will give you the hex string version, and using ObjectId().tojson() will give you the 'ObjectId("")' version, and these techniques work in both 2.0 and 2.2. I filed documentation tickets https://jira.mongodb.org/browse/DOCS-584 and https://jira.mongodb.org/browse/DOCS-586 to get this information into the release notes and other documentation. On Thursday, August 30, 2012 8:40:05 AM UTC-4, danpolites wrote: > > We have been using strings for our IDs for quite some time now and > whenever we needed to insert outside of our app, we would use (new > ObjectId()).toString() in order to generator a unique ID. We recently > installed 2.2 in our dev environment and the output of this has changed. > > 2.0.7 > > (new ObjectId().toString()) outputs a string in this format > '503f5d6db24963be84955d32' > > 2.2 > > (new ObjectId().toString()) outputs a string in this format > 'ObjectId("503f5d1c3871d765813428b5")' > > Is there an alternate way to get the ID string in 2.2? > ------=_Part_461_10110513.1349635705678 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable
Yes, this was a breaking change and should have been flagged in the re= lease notes.  Using the "str" property of ObjectId() will give you the= hex string version, and using ObjectId().tojson() will give you the 'Objec= tId("<hex string>")' version, and these techniques work in both 2.0 a= nd 2.2.

I filed documentation tickets  https://jira.mongodb.o= rg/browse/DOCS-584 and  https://jira.mongodb.o= rg/browse/DOCS-586 to get this information into the release notes = and other documentation.

On Thursday, August 30, 2012 8:40:05 AM UTC= -4, danpolites wrote:
We have b= een using strings for our IDs for quite some time now and whenever we neede= d to insert outside of our app, we would use (new ObjectId()).toString() in= order to generator a unique ID. We recently installed 2.2 in our dev envir= onment and the output of this has changed.

2.0.7

(new ObjectId().toString()) outputs a string in this form= at '503f5d6db24963be84955d32'

2.2

(new ObjectId().toString()) outputs a string in this format 'Objec= tId("503f5d1c3871d765813428b5")'

Is there= an alternate way to get the ID string in 2.2?
------=_Part_461_10110513.1349635705678-- ------=_Part_460_24371337.1349635705678--