[01:16:16] <devnill> I lost my admin credentials, how can I reset them?
[01:16:27] <devnill> Im running mongo on a linux server
[01:27:45] <Baribal> devnill, how about deactivating auth and setting new ones?
[02:04:36] <Baribal> MWAHAHAHA, I'm generating 10 million records with random numbers, just to see the effects of indexing!
[02:05:04] <Baribal> BTW, is mongod threaded in any way?
[02:05:21] <skered> Can you use vi key binds in mongo shell 2.0.6?
[02:15:22] <Baribal> Interesting... The index seems to halve the insert rate.
[02:57:25] <frozenlock> I want to keep an history of every changes that occured in say {"key1" data "key2" data}. If key2's data doesn't change really often, is it possible to make it refer to the last known change?
[02:58:12] <frozenlock> For example: {"key1": 100 "key2" "abc"}, {"key1": 101 "key2" "abc"}, {"key1": 105 "key2" "abc"}. Could it be something like {"key1": 100 "key2" "abc"}, {"key1": 101 "key2" _}, {"key1": 105 "key2" _}, where _ will return "abc"?
[03:01:33] <phira> frozenlock: you're probably just asking for trouble, I'd suggest just making a complete copy of the document and storing it in a history collection
[03:01:41] <Baribal> frozenlock, how about adding a revision number?
[03:06:12] <frozenlock> Baribal: Hmm could work, but in my case I have mostly 1 value that's changing quite often and a bunch a others that remain 'mostly' static. Adding a revision for each would eat up any saved storage :(
[03:06:53] <frozenlock> phira: As it is that's exaclty what I'm doing, I was just wondering if there was a more efficient way of doing it. My DB is eating diskspace :)
[03:07:04] <Baribal> I just scaled up from 1 to 10 million documents, a query that took 0.5 seconds now takes 3.5 seconds. I thought indexes would scale better?
[03:07:11] <phira> buy more diskspace, it's a much simpler, more reliable solution
[03:10:41] <frozenlock> Or use an _id for each revision :p
[03:10:56] <phira> typically it's a failure even if you use a timestamp. The problem is that a new version of a document is typically derived from an old one, which means you actually have a concurrency conflict anyway - imagine two people changing a word doc and saving a new version, each has made a change based on version A, resulting in versions B and C, but C, even though it's the last one, is not derived from B
[03:15:09] <Baribal> Ah, I thought you meant that there was already a mechanism in place.
[03:15:23] <phira> an example of that is simply generating a big random number for yourself, then doing update() on the document assigning owner_task: $number, and then checking to see if the number on the document matches yours.
[03:15:39] <phira> where the update only writes if there's no existing one of course
[03:15:46] <phira> that way, if your number is there, you won the lock
[03:16:13] <phira> transactions are a much more difficult problem, but they're not necessary for this problem.
[03:16:47] <_m> Baribal: Basically, if you use set safe to true for a connection, you'll lock during an update. More-or-less.
[06:17:30] <ChrisPartridge> is it OK to use @ symbol in collection names?
[06:32:14] <crudson> ChrisPartridge: is there a good reason to?
[06:38:37] <the-erm> Is there a better way to get distinct keys in a collection than this? http://stackoverflow.com/questions/2298870/mongodb-get-names-of-all-keys-in-collection
[06:42:47] <crudson> the-erm: seems fine to me, but with questions like this I tend to ask the reason why from a document structure point of view. It's often easier to have known keys and variable values rather than keys being "freeform", if you get where I am coming from. This can manifest itself in many problematic ways down the road.
[06:43:29] <the-erm> I've inherited that kind of code.
[06:45:04] <crudson> the-erm: in that case a map-reduce would be my approach too. emit property values as keys and 'nothing' as value, unless you also want to count the frequency of the keys.
[06:46:41] <samurai2> hi there, how to do something like db.collection.find().sort({ts:-1}).limit(1) in java driver? thanks :)
[06:50:37] <crudson> samurai2: http://api.mongodb.org/java/current/com/mongodb/DBCursor.html - sort and limit are right there on the cursor object
[08:55:12] <chovy> is there an easy way to get the most recent item in a collection?
[08:58:57] <crudson> chovy: not *really* - if you use the default _id you could maybe in a non-sharded environment use it but if you want to do this either use a capped collection or add some field that represents insert_date
[09:04:03] <chovy> i am just trying to avoid doing this:
[10:08:16] <fatninja> I have a collection that has a ISODate() field, and an integer value field. I would like to get all these dates by days, with the total of all the integer value field. Any good approaches on this one ?
[10:41:44] <Baribal> fatninja, You mean you prodive a date (range) and want to get the sum of the corresponding integers?
[10:42:19] <Baribal> I think aggregation would be the hippest way to do that. If you want intermediate results, mapreduce.
[11:28:51] <fatninja> ok, so aggregation might be the solution
[11:36:34] <NodeX> what's the issue you're trying to overcome?
[12:08:18] <NodeX> it's a simple enough statement lol
[12:08:29] <NodeX> it depends on what you need from your database
[12:11:46] <remonvv> visof, your question is roughly similar to asking "Can a truck do what a Ferrari can?" and NodeX asking "Depends, do you want to move people or go 200mph"
[12:12:07] <remonvv> In other words, tell us what you want to do with it. Obviously a NoSQL database isn't going to be a drop in replacement for an RDBMS.
[12:12:11] <NodeX> I have come to the conclusion that CSRF is not 100% preventable :(
[12:15:21] <NodeX> but even with token generation an exploiter can always generate said token in another shell and pass that information around their system to send to yours
[12:17:11] <visof> NodeX, is mongodb suitable to work fine with facebook ?
[12:19:51] <NodeX> visof : facebook does not entirely run on mysql - only parts of it]
[12:51:21] <jdevelop> Hi all! I have collection os projects and collection of permission for the project, permissions for project holds documents with project id and user id, and some ACLs. Now I want to find all projects which have specific ACL. How do I use map-reduce in order to join 2 collections? Do I need to follow http://tebros.com/2011/07/using-mongodb-mapreduce-to-join-2-collections/ ?
[12:51:43] <jdevelop> or may be newer versions of mongo have something else for achieving this?
[12:53:06] <Gargoyle> jdevelop: It's not relational. Get a list of the project_id's from your permissions colleciton and then use those id's to fetch the projects.
[12:53:35] <jdevelop> Gargoyle: that list could have millions of records
[12:53:50] <jdevelop> not practical to take it into memory
[13:01:09] <Gargoyle> jdevelop: Well. It sounds like you have a relational like schema in a non relational db, so you are going to struggle. I think map/reduce might help, but you'll still run into memory issues!
[13:03:04] <NodeX> I attacked this kind of problem with groups
[15:00:21] <meghan> fyi, the office office hours for M101 course (mongodb for developers) happening at https://plus.google.com/u/1/101024085748034940765/posts/BukcLAgXWhi
[15:00:45] <Derick> sorry meghan, I'm a drop out :-/
[15:09:11] <NodeX> quick tip for anyone using Eway as a payment provider - they are about to go into liquidation so you may want to cancel your accounts and find another provider
[15:25:57] <P-Alex> NodeX, problem solved thx all :)
[15:26:09] <P-Alex> the second error if a sequence of the previous insert
[15:29:09] <wiseguysonly> I've managed to master group and sump, but now I am trying to do something for which I have no clue how to start. I want the sum of a field for each of the last 7 days.
[15:29:37] <wiseguysonly> so 2nd = x, 3rd = x etc etc.
[15:32:08] <makin> Hi people I'm very confused with this error: http://stackoverflow.com/questions/13310300/doctrine-mongo-group-query Anyone can help me?
[15:32:45] <stefancrs> sorry, I know this question is slightly off-topic, but I'm developing a restful API with mongodb as the storage. I want to be able to do queries through query parameters but can't really think of a good way to specify values in an embedded object. For example /api/users?location.city=brooklyn&age=34 or whatever. I understand I need to take another aproach, but I'm out of ideas... :)
[15:35:48] <stefancrs> I _could_ of course just send the actual string for the query, like /api/users?query={"$and" : ["location.city" : "brooklyn", "age" : 34]}, is that the best way forward? I'd prefer if it wasn't THAT mongodb'ified on the API level... :)
[15:39:07] <Baribal> stefancrs, that sounds interesting, could you repeat the beginning of the question?
[15:39:28] <stefancrs> sorry, I know this question is slightly off-topic, but I'm developing a restful API with mongodb as the storage. I want to be able to do queries through query parameters but can't really think of a good way to specify values in an embedded object. For example /api/users?location.city=brooklyn&age=34 or whatever. I understand I need to take another aproach, but I'm out of ideas... :)
[15:39:55] <NodeX> stefancrs : you really should not let people blindly send you queries
[15:39:59] <stefancrs> and oh, sorry, forgot some {} in the query-string version...
[15:43:58] <stefancrs> but I don't think I'll ever need to expose anything but AND'ed operations
[15:44:16] <stefancrs> so I could just have a flat json array I think
[15:45:09] <Baribal> stalled, I think you're going at it the wrong way, the "What can I provide?". First ask yourself what you want or need to provide, then expose that as API and glue it to mongo internally.
[15:57:08] <Derick> stefancrs: that was a simple example
[15:57:28] <stefancrs> yeah, but understand that authorization is required and you can only read data you're allowed to read
[15:57:57] <stefancrs> what would be a good example, as in something bad happens?
[16:00:03] <nledon> Hello all. Anyone know why I have a node who's stat is UNKNOWN? I have one PRIMARY who's been initiated and added Mr.UNknown just fine. But it won't become secondary.
[16:04:47] <wiseguysonly> I'm doing the following: http://pastebin.com/YF1apX08 but it seems to bring back the sum of all the docs rather than just for the id specified
[16:05:20] <wiseguysonly> I want to use group really for a sum of playtime for the last x days
[19:37:51] <cedrichurst> geospatial question, i know it's possible to get the list of documents inside a specified polygon
[19:38:21] <cedrichurst> but if my documents contain polygons, is there a way to get the list of documents with polygons surrounding a specified point?
[19:38:42] <cedrichurst> so my query would provide a geopoint
[19:38:47] <ckd> JBJB: are your document ids actually stored like that?
[19:38:58] <cedrichurst> and the results would be all documents with a polygon that the provided point is inside
[20:00:55] <fumduq> I'm having some trouble with replication in which replicas do not catch up to their masters. the LVM module (that supports the mongo directory) crashes in the kernel, and when brought back to life, mongo just gets more and more out of sync
[20:02:40] <fumduq> is there a way for me to determine which operation is causing replication to stop?
[20:56:27] <fumduq> well, got a nice couple of stack traces, and now it says that it's in sync