The actual code is below.
On Tue, Jun 8, 2010 at 8:50 AM, SaraC <sarajchi...
> The problem is this application is a url shortener and requires an
> identifier that can be hashed and
> used for those purposes. I don't know of another solution while
> ensuring uniqueness.
> On Jun 8, 2:49 am, Ken Egozi <egoz...@gmail.com> wrote:
> > select MAX is definitely wrong for the reasons mentioned.
> > I would avoid Identity behaviour anyway, and not only because of the
> > sharding issue. Using Identity means that every Insert must immediately
> > the database. This is not always desirable, as you might want to do more
> > stuff with the Id, but postpone the DB call for later for various
> > Now using the ObjectId approach has its limitations also, mainly the size
> > and the readability, as some systems like human readable ids (order
> > user id, customer service call id, etc.)
> > you can enjoy both worlds if you employ the hi-lo algorithm (or
> > a variation thereof). You get an integer id, generally sequential, fast
> > generate and simple to implement.
> > The docs for Hibernate/NHibernate are all full with reasons to avoid
> > Identity and use GuidComb (their equivalence of ObjectId) or HiLo
> > On Tue, Jun 8, 2010 at 9:35 AM, Jørn Wildt <j...@fjeldgruppen.dk> wrote:
> > > Check this request for some thoughts:
> > >http://jira.mongodb.org/browse/SERVER-195
> > > Beware of concurrency issues: two reades may read MAX() = 10 and then
> > > both of them increment it to 11. You need to use MongoDB's various
> > > atomic operation to ensure this operation is safe.
> > > /Jørn
> > > On Jun 8, 8:19 am, SaraC <sarajchi...@gmail.com> wrote:
> > > > I'm new to NoSQL, I'm looking to either create an identity field
> > > > starts at 0) or build my own by selecting a max value.
> > > > I understand that the Mongo Ids are timestamps and can be used as
> > > > such. However, I need a smaller value for this column.
> > > > Thanks a bunch!
> > > --
> > > You received this message because you are subscribed to the Google
> > > "NoRM mongodb" group.
> > > To post to this group, send email to firstname.lastname@example.org.
> > > To unsubscribe from this group, send email to
> > > email@example.com<norm-mongodb%2Bunsubscribe@google groups.com>
> <norm-mongodb%2Bunsubscribe@google groups.com>
> > > .
> > > For more options, visit this group at
> > >http://groups.google.com/group/norm-mongodb?hl=en.
> > --
> > Ken Egozi.
> http://www.kenegozi.com/bloghttp://www.delver.comhttp://www.musicglue...כנס הקהילתי הראשון למפתחי דוטנט - בואו בהמוניכם
> You received this message because you are subscribed to the Google Groups
> "NoRM mongodb" group.
> To post to this group, send email to firstname.lastname@example.org.
> To unsubscribe from this group, send email to
> email@example.com<norm-mongodb%2Bunsubscribe@google groups.com>
> For more options, visit this group at