PMXBOT Log file Viewer

Help | Karma | Search:

#mongodb logs for Wednesday the 12th of June, 2013

(Back to #mongodb overview) (Back to channel listing) (Animate logs)
[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?
[07:43:45] <ron> well...
[07:44:08] <kali> yeah, just craft a id from the timestamp you're interested in, and use $gt
[07:44:36] <pinvok3> Can I use a simple $where and compare it with $gt?
[07:44:55] <pinvok3> Ah great, thought there is a special function for it. Thanks :)
[07:45:01] <kali> pinvok3: you should never use $where
[07:45:12] <kali> pinvok3: javascript is a performance killer
[07:45:47] <pinvok3> kali, what else would you suggest? I'd use the php aggregation framework
[07:48:32] <kali> look at this: http://stackoverflow.com/questions/14370143/create-mongodb-objectid-from-date-in-the-past-using-php-driver
[07:48:46] <kali> to craft an objectid for a given timestamp
[07:49:09] <kali> then just find({ _id: { $gt: your_object_id }})
[07:50:27] <pinvok3> Oh no. Girlfriend let me awake till 4 oclock. Yeah, find is the best way I guess..
[07:50:40] <pinvok3> Thanks for the correction :)
[08:52:23] <pinvok3> Oh by the way kali, I really want to compare full ID's not just a timestamp
[08:53:00] <pinvok3> Do I have to extract the timestamp first, and then craft a new ID?
[08:55:00] <kali> nope, just use you _id in that case
[09:03:08] <pinvok3> kali: Thanks. I forgot the new MongoId($ID) that's why I got no results (:
[09:03:49] <Nodex> lol
[09:05:12] <agend> hello guys
[09:05:34] <agend> can i modify _id doc during mapreduce
[09:05:47] <agend> i'd like to add something in finalize fn
[09:05:51] <agend> ?
[09:06:36] <Derick> agend: any reason why you can't use the aggregation framework?
[09:07:26] <agend> yes - thera are resons
[09:07:34] <agend> can i modify _id ?
[09:09:30] <kali> agend: no you can't that would not make any sense at all
[09:10:01] <agend> ?
[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:15:08] <agend> i can't do this?
[09:16:06] <kali> you can: in the mapper
[09:16:11] <kali> but not in the reducer
[09:17:10] <agend> how can i do it in mapper?
[09:20:15] <ak5> hi guys, is a random function for mongodb really not in the cards?
[09:20:29] <agend> kali: thanks - seems to be working :)
[09:21:40] <Nodex> ak5 : random function?
[09:23:33] <ak5> Nodex: something that randomizes results before returning the query
[09:24:02] <ak5> Nodex: SQL would be ORDER BY RAND()
[09:24:30] <ak5> https://jira.mongodb.org/browse/SERVER-533 I guess it is planned but not scheduled
[09:25:17] <kali> ak5: one way to achieve this is to have your app store a random value in the documents
[09:25:38] <ak5> kali: yeah I saw that but seriously... that's a hack if I ever saw one
[09:26:51] <Nodex> best use mysql then I suppose
[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:30:48] <kali> so i'm not sure.
[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()
[11:25:23] <fatih> Hi everyone
[11:25:24] <fatih> https://gist.github.com/fatih/5764501
[11:25:40] <fatih> how can I get the field inside "example-123"
[11:25:57] <fatih> I need to use result projection but don't know where to begin
[11:26:04] <Nodex> db.foo.find({"entries.example-123":"some-value"});
[11:26:16] <fatih> I have quering always agains docname
[11:28:00] <fatih> Nodex this doesn't work
[11:29:31] <Nodex> awesome, define "Doesn't work" .. does it sit watchign TV all day because it can't find a job?
[11:29:49] <fatih> it doesn't return the document
[11:29:59] <fatih> it's just a empty return
[11:30:01] <fatih> nothing there
[11:30:08] <barnes> Is there a way to make mongod not log "connection accepted/closed events" to logfile?
[11:30:16] <Nodex> please pastebin your query
[11:31:08] <fatih> db.foo.find({'entries.example-123':'example-123'})
[11:31:43] <Nodex> ok good luck
[11:32:00] <Nodex> if you can't work out to change the various variables then I can't help you sorry
[11:32:52] <fatih> like what? i didn't understand what you mean. I've past a simple document that shows how that is configured
[11:32:57] <fatih> there might be hunders of entries
[11:33:06] <fatih> I just want that it returns me single one
[11:33:12] <fatih> what do you want me to do?
[11:33:58] <Nodex> is your collection called "foo" ?
[11:35:02] <fatih> ok I've fodun the solutio
[11:35:29] <fatih> db.foo.find({"docname":"foo"}, {'entries.example-123':1})
[11:36:09] <Nodex> "entries" is not a "field" ... it's an object or an embedded document
[11:36:51] <fatih> yeah these are fields in Go, sorry for using different name
[12:21:21] <Robbie> Hi, when i restore using mongorestore, do i have to restore to the primary node, or can/should it be done to a secondary?
[12:27:15] <stennie> @Robbie: you can only write to the primary, so restoring to a secondary isn't an option
[12:27:34] <Robbie> thanks stennie, i thought so
[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" ?
[13:51:03] <Nodex> yes
[13:51:08] <Nodex> well, if you want it fast
[13:53:54] <saml> actually it's {paths: ['/a/b/c.jpg', .. some alternative vanity urls] }
[13:55:25] <saml> let me try and see :P
[15:51:15] <generic_nick> does anyone use the python pymongo driver?