--
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To post to this group, send email to mongod...@googlegroups.com.
To unsubscribe from this group, send email to mongodb-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.
Thanks Kyle,
So where does "counter" come from? Does it increment? In any given
timestamp second, could there be a duplicate "counter" value?
I am preventing insertion of duplicate documents, so I don't think we
would run into any problem with more than one client processing same
document.
Problem I see is, if there is a delay between generation of _id and
writing document, when doing a query sorting by objectId, there is no
way to be sure that in any given instant I am getting correctly
ordered list (enough to trust that I have all records between first
and last in result). New items could finally sneak into result, which
will throw skip command out of wack. Skip might cause missing of new
records, and also would return a record I already received since there
might be more now in the same query. Right?
To unsubscribe from this group, send email to mongodb-user...@googlegroups.com.
I think you could (depending on your use case) turn to capped
collections and just "assume" insertion order is the same documents were
created in (even if that might just be roughly true).
I have a some use cases where the tradeoff of speed for "being a bit off
in terms of ordering by creation time" is no problem but the speed gain
all worth doing it.
[0] http://www.markus-gattol.name/ws/mongodb.html#natural_order
jdill> One option that I considered was to only allow 1 client to
jdill> insert records into mongo one by one...by basically using a
jdill> queue of some sort. But, this is still considered optimistic
jdill> (not guaranteed), isn't it?
If you use the combination of a *single client inserting into a capped
collection*, then insertion time will be creation time i.e. if you move
the database cursor across your collection it will see documents sorted
by creation time.
If you deviate from that combo i.e. several clients and/or normal
collection, then you probably will not get insertion_order ==
creation_time.