[00:27:08] <Wardrop> Oh wait, no it doesn't work in mongo shell
[02:42:34] <christopherbull> hey, I'm scratching my head a bit about mapReduce, specifically when reduce is called. I've just got a test case collection set up with 524 documents, the map task goes over these and sets a key that is shared across all the documents in the collection, then reduce is mean't to collate a total of these object for the given key. I've put some print statements in though and am seeing some behaviour that I don't understand in the logs: even
[02:42:35] <christopherbull> though the key doesn't change for all documents, reduce is run 3 times, so instead of getting the actual count (524), i'm getting the count of the 3rd time reduce is run. This is consistent each time I run it. I'm guessing we're misunderstanding how mapReduce works, but was just wondering if anyone can provide any help with this?
[02:53:03] <jfisk1987> newbie question, i have a simple node.js app that is inserting a dictionary in my db... but i have no idea where the actual mongo file is stored
[06:26:35] <ak5> hi guys, so I have a query that does regex match with "title" of docs and I want it to be sorted ascending by "price". does ensureIndex({"price": -1}) create the proper index for that? This is my first time using indices :)
[07:02:30] <ak5> db.scraped.find({"title": {$regex: "iphone"}}).sort({"page_views": -1}).limit(5); <- also this query is not giving me the 5 docs with the highest "page_views", why is that?
[07:43:02] <patrickleng> db.eval("new date('2013-3-4')") doesn't create a js date object. how come?
[10:28:12] <nico_> having a list of geographical places from different types (restaurant, schools), what is the mongodb query to get the closest point ($geoNear) of each type ($group) from a given location, any help?
[10:49:43] <eddd> hi a have a problem with aggregation in mongo, someone take a look and give me a hit, how to aggregate substractions between fields ? http://pastie.org/8051463
[11:45:31] <trj> Hi, can anyone help? I have a collection of docs like this, {a:[{b:"foo",c:"bar"},{b:"baz",c:"quux"}]}, how can I find() those docs in the collection which have c:"quux" in them?
[11:57:15] <trj> eddd: Thanks, but I'm not looking for a substring, I'm looking for docs which have an object in the "a" array containing the property "c" with the value "quux".
[11:59:24] <joannac> trj: are you looking for something like the $in operator?
[13:23:11] <freddj> I did not verify myself but https://jira.mongodb.org/browse/SERVER-8907 suggests it does work. I'm going to try right now.
[13:23:29] <freddj> I mean "suggests it does NOT work"
[13:24:16] <Derick> depends on where you put the [ ] :-)
[13:25:12] <moian> I'm looking to set up an automatic backup system for a sharded cluster (each shard is a replica set), would you have some advices about the best way to do it ?
[13:36:54] <gimpy7489> moian: Depends on the environment, does yours support a consistent snapshot of the filesystem? How long are you ok with an a secondary to be down for if you want a cold backup without snapshots? Are you ok with only hot backups instead?
[13:46:02] <moian> gimpy7489: I don't know if my environment supports that. All servers are running under Ubuntu 12.04, nothing special otherwise. The best would be cold backups, but it depends on the time secondaries would need to be down, I think an hour would be a maximum
[13:51:44] <gimpy7489> moian: Test it and find out. No one can tell how long it will take to back up in your environment but you. Also, keep in mind that when the secondary is brought back online it will affect the primary due to the work needed to catch up.
[13:53:23] <deepy> Right, so previously I was seeing 25% locked and I had 9k update and querys / second. Now I sharded this and I'm seeing 7k updates and querys / second with 0% locked :(
[13:54:18] <deepy> but that's 40k less than I need and I'm using UNACKNOWLEDGED, I'm querying on _id and only getting _id
[13:54:33] <moian> gimpy7489: OK, then do you think snapshots stay a better choice
[13:54:34] <deepy> which is a NumberLong and I'm using the java driver
[13:55:59] <dariusz> I've got a problem with distinct. I need distinct from one field but onlu from records that have date stored in one field greater than some given.
[13:57:51] <dariusz> I've try this, but it ignore this statement with gte
[13:58:05] <gimpy7489> moian: Depends on the environment. I like snapshots but they are more complicated, more things can go wrong. We use snapshots on our "big" Oracle databases just so there is a shorter outage.
[14:35:01] <n06> well maybe you can help me out, and then I can leave you alone
[14:36:07] <n06> I'm tryint to set the readPreference on my cluste to no avail
[14:36:53] <n06> right now i have something along the lines of "db.collection.find().setReadPreference(new ReadPreference(ReadPreference.SECONDARY))
[14:37:33] <n06> but im gettinga ReferenceError: ReadPreference not defined
[14:42:45] <Number6> n06: You can use slaveOk to read from secondaries
[14:43:23] <Number6> Although that is deprecated, so http://docs.mongodb.org/manual/reference/method/Mongo.setReadPref/#Mongo.setReadPref might be better
[14:44:29] <n06> hm ok i thought i had implemented readPref properly (i saw that slaveok was deprecated) but there are a lot of conflicting docs
[14:49:44] <n06> Number6, I think the setReadPref() command if for the shell, if I were to set this from the application (node js) wouldn't it be the way I said before?
[14:52:42] <Derick> dariusz: doctrine does support it though
[14:56:10] <n06> yes i have, but i dont understand how to implement this for my entire cluster. Do i need to specify each replSet or can I just set the global readPref through mongos?
[15:03:50] <dariusz> Derick: when I var_dump endDate taken from db, it is MongoDate type
[15:04:14] <dariusz> and contains sec and usec fields. sec contains int and usec contains 0
[15:04:20] <Derick> what query does it actually send to the database? All those ORMs hide so much stuff
[15:05:32] <dariusz> Derick: I don't know, I was trying to find some method to print that query to me, but can't found. You know some?
[15:15:44] <bjonnh> Hi, I'm using the c++api of mongo. I'm converting id's with p.getField("_id").OID().str() to be able to manipulate (store, user forms…) them with the framework I use (Wt). But how can I convert them back to use them in queries ?
[15:17:48] <Derick> dariusz: https://github.com/mongodb/mongo-php-driver/blob/master/tests/mongos/stream-logger-001.phpt#L58 and https://github.com/mongodb/mongo-php-driver/blob/master/tests/mongos/stream-logger-001.phpt#L46 and https://github.com/mongodb/mongo-php-driver/blob/master/tests/mongos/stream-logger-001.phpt#L13
[15:19:09] <dariusz> Derick: Ok, it seems that doctrine distinc have only one parameter with field to made distinck on, and don't have any possibility to use query :/
[15:20:13] <dariusz> Derick: Yes, I also think so...
[15:29:31] <jmikola> dariusz: The Collection::distinct() wrapper supports a query: https://github.com/doctrine/mongodb/blob/master/lib/Doctrine/MongoDB/Collection.php#L411
[15:30:32] <jmikola> and the query builder should support it as well: https://github.com/doctrine/mongodb/blob/master/lib/Doctrine/MongoDB/Query/Query.php#L212
[15:30:47] <jmikola> it incorporates the distinctField option from the builder, as well as the query
[15:44:15] <dariusz> jmikola: Yup, it doesn't made any error when I put the query, but in my case query is fully ignored :/
[18:15:32] <GRiD> hey all. if i want to add --keyFile to an existing sharded cluster (without auth), do i have to shut all nodes down first? if i try to do it piecemeal, the first one is giving an error "command denied" when it tries to come up
[18:16:17] <n06> GRiD, I believe you can create an admin user, switch to it, and then add --keyFile
[18:17:38] <GRiD> well i've added the admin user (without auth), but if i take e.g. a mongod from one of the replica sets down and try to being it back up with keyFile, it fails with the command denied
[18:18:18] <GRiD> so i'm wondering if i have to take them _all_ down and bring them all back up with keyFile. as in, you can't have mixed nodes, some with keyFile and some without
[18:19:45] <n06> did you chmod 700 the keyfile? also make sure that you chmod from the user that will be running the mongod proccess, you should be able to have mixed because its a flag within each process?
[18:21:17] <n06> "The content of the key file is arbitrary but must be the same on all members of the replica set and on all mongos instances that connect to the set"
[18:21:33] <n06> it looks like you might have to take everything down :/
[18:21:40] <GRiD> it's looking that way yeah ok thanks