[06:20:14] <timte> Can I get mongo to also log the user (if any) that tries to authenticate?
[06:20:35] <himsin> can anyone help me in converting this sql query to mongo: select SUM(UNIX_TIMESTAMP(created_at) - UNIX_TIMESTAMP(DATE(created_at))) from table
[07:42:54] <pinvok3> Hey there. What is the easiest way to fetch all documents after a variable _id? Ids contain the timestamp afaik, should be easy, right?
[09:11:16] <agend> during reduce I make a new doc - why changing id wouldn't make sense at all?
[09:12:48] <kali> agend: because reduce should only *reduce*. it can be called 0, 1 or N times so its input should be in the same exact format at the output
[09:14:17] <agend> look - i want to keep in one collection aggregated stats for hr, day, month. in _id i have: type: 'h', date
[09:15:02] <agend> now when i aggregate data from hours to days i want to write the type to _id : type: 'd'
[09:27:10] <Nodex> you can do it appside no problem, just takes 2 queries is all
[09:30:24] <kali> ak5: sql's order by rand() is a terrible hack. highly inefficient if handled in a naive but "proper" sql semantics (sort is n*log(n) and no indexing is possible) or else very hackish as the server implementation needs to implements a special case of order by
[09:32:15] <Nodex> either keep a counter or do 2 queries to determine the number of rows for a query to create a random "skip" number
[09:34:50] <ak5> Ok, that's what i was doing anyway :D
[09:35:38] <Nodex> count() can go out the window in terms of performance on large collections where you have a query ... a simple find() uses internal counters to provide a faster count() so beware of that
[09:35:58] <Nodex> I did read somewhere that they're working to improve count()
[12:40:15] <stennie> @Robbie: did you have a goal in trying to restore to a secondary (i.e. reduce the impact on the primary or restore the data faster)? or were you just curious if it was possible?
[12:43:50] <Robbie> @stennie: I've just finished upgrading my backup script so that it uses the secondary (to reduce impact on the primary), and i wondered if something similar would be possible in my restore script
[12:45:42] <stennie> If you're concerned about the impact of the restore you could consider --w # (number of replicas required to acknowledge a write): http://docs.mongodb.org/manual/reference/program/mongorestore/#cmdoption-mongorestore--w or --noIndexRestore (don't build indexes -- but you'll have to add later)
[12:50:41] <Robbie> so adding --w 1 would confirm replication to 1 member? I'm not sure i understand how this reduces the impact on the primary?
[12:52:28] <stennie> normally mongorestore will try to restore as quickly as possible (w:0) .. waiting for acknowledgement will slow down the rate of inserts
[12:53:49] <stennie> similar to the secondaryThrottle option for chunk migration in sharded clusters: http://docs.mongodb.org/v2.2/tutorial/configure-sharded-cluster-balancer/#require-replication-before-chunk-migration-secondary-throttle
[12:53:50] <Robbie> ahh, i understand now, thanks for the advice
[12:54:56] <Robbie> im not currently sharding my data, but i'll bear that in mind for later
[13:49:45] <saml> hey, I want to store file paths {path: '/a/b/c.jpg'} and provide file browser interface. db.coll.find({path: /^\/a\/b\//}) is this okay? to find all elements under folder /a/b/
[13:50:10] <saml> do i need to create index on "path" ?