[00:30:29] <_m> Second google result says, new MongoDate(gmmktime());
[00:31:28] <_m> Also see: http://stackoverflow.com/questions/7021678/how-can-i-handle-datetime-in-mongodb-with-php
[00:32:19] <_m> Think the key is that PHP's DateTime doesn't know anything about Timezone information.
[02:51:55] <wachpwnski> Is there a way I can have mongo drop elements from an array after a limit?
[02:59:05] <wachpwnski> Here is my schema, I am wondering if I can limit the size of the logins array. https://gist.github.com/b383ebc37311a93d4e23
[03:43:37] <jgornick> Hey guys, can I use the aggregation framework to properly query and return on embedded documents? For example, can I create an aggregation query to query embedded documents and return those as the result?
[03:55:20] <crudson> wachpwnski: you can't impose a 'rule' that results in mongodb enforcing that outside of application or maintenance code
[04:05:30] <wachpwnski> crudson: would it be better to just keep a circular queue and reference the user?
[04:15:12] <crudson> wachpwnski: If you want to retain n logins for each user then a single capped collection referencing user would not be a good solution. I'd maintain it on a per user basis. I'd look at, vote for, and keep an eye on this: https://jira.mongodb.org/browse/SERVER-991
[04:20:30] <wachpwnski> right now can I get size then append and pop?
[04:22:26] <wachpwnski> also does mongo have a global collection incrementer I can use?
[04:33:47] <jgornick> When you want to unwind a field, do you need to project that field?
[04:33:55] <jgornick> This is in the aggregation framework.
[04:35:35] <crudson> wachpwnski: note that size of array isn't available unless you track it (other than querying $size). You will have to do some manually work to maintain the array. What do you mean by "global collection incrementer"? Like a traditional db sequence?
[06:03:41] <ron> that's relatively old. lucene underwent quite a few changes since. however, that doesn't mean clucene isn't good. nevertheless, you should look at the functionality and not only the 'speed'.
[09:52:44] <xenocom> if I want to run mongodb on AWS... or at all, really... how can I compact without pulling my site offline?
[09:52:52] <arussel> ideally, I would do the splitting/setting in an create/update listener, is there something like this ?
[09:52:56] <xenocom> do I rely on my replica sets to fill the void while compacting?
[10:05:40] <NodeX> arussel : can you explain your problem any differently, what you are asking doesn't make sense
[12:08:58] <driek> one of my config servers fails on update config.mongos query, the logs tell me 'exception: Invalid BSONObj size: 0'. I restarted all the config servers but this does not help. Any clue where to look?
[12:10:32] <boll> Is there anything in the mongodb development pipeline focusing on making gridfs work with reasonably sized data sets (ie. 300+ GB worth of file data)?
[12:22:49] <NodeX> what "doesn't" work about it boll ?
[13:13:24] <driek> I cant seem to disable my balancer, 'db.locks.find( { _id : "balancer" } ).pretty()' shows a lock in state 1. Should I just be more patient to let the balancing round finish, or is something wrong/stale?
[13:15:40] <driek> (v2, according to the docs a state of 2 denotes an active lock)
[13:17:17] <amirc> NodeX : You mean to do a 'manual' counter? after each call to run update with $inc
[13:30:50] <boll> NodeX: mongo is acting as the cache
[13:31:16] <boll> it stores various resized and modified versions of source images
[13:36:10] <NodeX> if you shift the grid away from mongo you will only compound the problem, the files are mmapes by the operating system for a reason (MRU)
[13:37:41] <boll> NodeX: keeping the files in a flat file system with logarithmic access times currently seems a lot more plausible
[13:38:07] <boll> (logarithmic in the number of files per directory)
[13:38:43] <NodeX> adding an in memory cache to serve them will keep your app flying
[13:39:28] <boll> problem is that LRU isn't really a terribly good algorithm, as the files get hit more or less randomly
[13:39:42] <boll> so figuring out what to keep in memory is not trivial
[13:39:54] <boll> which I guess is what's also causing mongo to choke
[13:41:44] <NodeX> you can be smart about it with somethign like redis ... use the id as an expring key, check the key before checking the DB - if exists then serve from memory/cache else serve from Mongo.. will eat a bit of ram / disk but will relieve your system a bit
[13:42:44] <boll> except if old files are as likely to get hit as old ones, that doesn't really gain me a lot, does it?
[13:43:04] <NodeX> your app takes care of invalidating ...
[13:43:37] <NodeX> or do you mean infrequent requests?
[13:44:26] <boll> it's a completely generic image manipulation service (written in php), which downloads images, manipulates them, and returns the manipulated image to the caller
[13:44:37] <boll> it then stores the original and the manipulated image
[13:45:03] <boll> it really has no way of knowing what images to expire
[13:45:30] <boll> since all images are theoretically equally likely to be requested at any given time
[13:45:33] <NodeX> I imagine in your case the original is not really needed after it's been manipulated?
[13:46:21] <boll> The original may be 150 MB, and the caller usually requests 4 or 5 different "versions" of it, so keeping the original around makes a bunch of sense
[13:46:35] <NodeX> but not after it's been manipulated?
[13:47:16] <boll> yeah, cause different callers (or client software) often requests different sizes of the same image (depending on the screen size of the client)
[13:47:47] <boll> so we often end up with maybe 20-50 versions of the same image over time
[13:48:08] <NodeX> if it was me I would keep hot data in a cache for X days (dependant on ram) and store the originals outside of mongo after manipulation
[13:48:41] <boll> Yeah, we may end up having to do that, it's just that gridfs is damn convenient :)
[13:48:52] <NodeX> if a new request to manipulate comes down the wire it get's added to the queue (load the original from the FS) and start all over again
[13:49:30] <NodeX> or... setup a second mongod to house originals - as they are infrequently accessed they won't hardly be mmapped
[13:50:18] <boll> Yeah, a hybrid solution may be the way to go. Thanks.
[13:53:00] <alz> does anyone know the correct way to build the shared mongoclient on 2.2.0?
[13:53:04] <alz> --sharedclient doesn't seem to do it anymore
[16:03:05] <gyre007> anyone here uses mongo community cookbook ? we are and just found out that it keeps restarting mongo every time chef-client runs...needless to say the restart forces master to change to slave...and some other node becomes master..
[16:45:37] <Almindor> what's the fastest way to update references? say I have a list of users with ObjectIds pointing to some collection A but I want to "exchange" that with another collection B and A is linked to B (each A has some link to B, not vice versa tho!)
[16:45:46] <Almindor> I tried a simple script to walk through them but it's uber slow
[16:47:13] <ron> you mean that updating ALL the records in your collection is slow? who would have guessed...
[17:09:49] <ron> and I only say okay because I'm hungry and going to eat :p
[17:12:45] <Vile> anyway, in that case objectID is completely useless, because will not be used at all
[17:55:10] <Neptu> i have a question about querying
[17:56:01] <Neptu> i have a collection where some fields are A = 1 another ones are A = 2, is it possible to get a query to retrieve all of them that has te bigger integer
[18:09:16] <Neptu> but i need the max of all the number as agregation
[18:11:34] <cmendes0101> I guess I dont know what your dataset looks like or what your doing but check out http://docs.mongodb.org/manual/reference/aggregation/, Search for $max. Its for grouping but maybe it will work for you
[18:12:36] <ludof> Hey, we need some help here for a "special" operation. We're moving from 1 mongos + 20 single shards to 3 mongos + 3 replicated shards. We're using mongodump from the old mongos to grab 800 gigs of data (one collection. Yet the process "almost" fail, it's terribly slow.
[18:14:17] <ludof> I/O are low on the active shard (100 reads/sec, less than 10 writes/sec), ram usage is low, load average is also low, mms give us 2 informations: average of 80 page faults and average of 4Mbits in network.
[18:14:46] <ludof> We have absolutely no insight about why it's very very slow or why it fail.
[18:19:35] <Neptu> i do not understand how i do a $max
[18:33:44] <cmendes0101> Theres a lot of people here but no one really talks
[18:40:22] <augustl> what's a good way to implement audit trails for documents? I was thinking of having a "history" array on the document itself, copying the entire document in on every change. I guess this'll work, a bit worried about the 16mb limit on document size though
[18:42:03] <ludof> augustl: a version key in your collection
[18:54:28] <Neptu> dam i cannot find an agregation of a max of that row...
[18:58:48] <augustl> ludof: the reason I liked the history array was that I thought that would be an atomic operatoin, but on second thought it won't.. So I might as well use that
[19:16:10] <arussel> I want to update a field of a document when the document is updated/created. Is there something like listener/trigger I could use.
[19:17:32] <ron> there are no triggers in mongodb.
[19:20:51] <arussel> what would be the way to create/update a keyword field using other field ?
[19:21:16] <arussel> does it has to be outside mongo ?
[19:21:20] <ron> can you give a more elaborate sample?
[19:24:19] <arussel> is there a reason for not implementing it or is it just that no one motivated enough needed it
[19:24:52] <NodeX> because a key value store is built for speed and schemaless properties and most of all scalability
[19:25:30] <NodeX> things like that should -allways- be appside logic, it just so happens a lazy developer added them directly into SQL
[19:25:46] <ron> actually, I believe it's a matter of demand. should the community ask for it, they may consider implementing it. it _will_ complicate sharded databases and such.
[19:26:13] <NodeX> and slow things down to much so don't hold your breath
[19:27:00] <ron> well, wrt to slowing things down, I believe it's up to the user to decide what's more important to them.
[19:27:43] <NodeX> it would slow down the core as i's effectivly an extra index to check for what to do / what to update
[19:27:51] <arussel> I'm very new to mongo so apologies for question, but isn't a document always persisted as a whole (so sharding doesn't really matter).
[19:27:56] <NodeX> so I really don't see it being implemented ever
[19:28:12] <arussel> if I want key value store I use redis
[19:31:53] <arussel> no more like: That could be an appside problem, but if you want, you can do it inside mongo too.
[19:32:18] <NodeX> but you can't do it in mongo so why would I say you could lol
[19:33:36] <NodeX> and regarding your sharding issue/comment .. documents are more analogous to rows in SQL and collections to tables
[19:33:55] <NodeX> A single document probably wouldn't get sharded
[19:34:43] <arussel> then updating a field of a doc using field from the same doc wouldn't be a problem in a sharded DB.
[19:34:53] <arussel> "Your code must split the title above into the keywords before saving. Note that this code (which is not part of Mongo DB) could do stemming, etc. too. (Perhaps someone in the community would like to write a standard module that does this...)"
[19:35:24] <arussel> when they say module, does this mean the module would update the doc, and the code would talk to the module ?
[19:38:04] <NodeX> if you're looking to do LIKE %% style queries in mongo you're going to be disapointed
[19:39:16] <Neptu> sort.($lala: -1) should give me a reverse list starting from the highest number to the smaller number right??
[19:39:22] <arussel> I need to implement a simple full text search and try to find the best way to do it
[19:39:30] <Neptu> sort.($lala: -1) should give me a reverse list starting from the highest number to the smaller number right??
[20:09:00] <Neptu> mmmmmmm when u do a find().sort() the find gets executed first and then it sorts it out??
[20:09:09] <Neptu> or it sorts it before the find?
[20:30:10] <_Tristan> I have users and items. Users have many items, and most of my reads will be looking up an individual item by it's id, along with it's owner's name. My question is, should I store users and items in separate collections, or should I store the items within the user's document?
[20:32:48] <_m> Store the items in a separate collection
[20:38:59] <cmendes0101> Neptu: Not 100% but it should do find first
[20:46:14] <mcav> If I have an index of {a: 1, b: 1}, is it redundant to have separate indexes for {a: 1} and {b: 1}? A quick test of the repl seems like it uses a btreecursor even if querying for just "a".
[22:22:06] <cmendes0101> How can I round a number in aggregate framework?
[23:45:58] <_m> cmendes0101: Assuming you'll need to do something like: http://bit.ly/bZfT7N
[23:46:38] <_m> Also see the "skip" examples on the same page.
[23:47:10] <_m> While they aren't exactly "aggregation framework" docs, you'll likely be able to do the same sort of operations.
[23:48:03] <cmendes0101> Well I need to round a number. Like 2.5 to 3.
[23:48:23] <cmendes0101> and im using aggregate(). Not sure how to execute something like that in there
[23:49:19] <_m> Again, that same method *should* work. Try it.
[23:49:36] <_m> Either that, or map/reduce your data.
[23:50:38] <cmendes0101> I've tried many options. I haven't specifically tried a map reduce since I didn't think I can execute that within the aggregate command but I'll see what that triggers
[23:51:15] <cmendes0101> Basically I'm doing $group to group by an ID and those records contain a number of seconds. I'm trying to get minutes rounded up. I have the minutes returning but there not rounded up, so the totals are not correct