PMXBOT Log file Viewer

Help | Karma | Search:

#mongodb logs for Monday the 17th of June, 2013

(Back to #mongodb overview) (Back to channel listing) (Animate logs)
[00:08:09] <dorkmafia> why does cursor.hasNext() throw a null pointer exception for me?
[00:08:58] <dorkmafia> i just did a DBCursor cursor = _collection.find()
[00:09:03] <dorkmafia> and the cursor length is 2
[00:20:29] <dorkmafia> :(
[00:25:17] <Wardrop> How come this: collection.find('_id' => {'$oid' => '51b15bc219b4c09b9bfd3e5a'})
[00:25:26] <Wardrop> Produces this: Mongo::OperationFailure: invalid operator: $oid
[00:25:29] <Wardrop> Using the Ruby driver
[00:26:00] <Wardrop> I thought $oid was a valid operator for referencing ObjectID's without having to instantiate any special BSON::ObjectId object
[00:26:24] <Wardrop> It works in the mongo shell
[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:52:36] <jfisk1987> hey gys
[02:52:37] <jfisk1987> guys*
[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
[02:53:22] <jfisk1987> http://pastebin.com/EKSMMWyY
[02:53:36] <jfisk1987> it is telling me success so things appear to be going smoothly
[04:53:26] <dorkmafia> (:
[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?
[07:44:30] <kali> try Date, not date
[09:33:51] <ggwalle> hi all
[09:34:06] <ggwalle> db.test.update({name:'hack1'}, {name:'hack99', b:18, age:101, {$addToSet:{'group.default': {$each:['bar11', 'bar22']}}}})
[09:34:21] <ggwalle> Mon Jun 17 17:31:39.011 JavaScript execution failed: SyntaxError: Unexpected token {
[09:34:26] <ggwalle> why?
[09:35:07] <ggwalle> any one can help me?
[10:21:54] <nico_> #mongodb
[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:52:22] <eddd> trj substr
[11:52:40] <eddd> http://stackoverflow.com/questions/10242501/how-to-find-a-substring-in-a-field-in-mongodb
[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?
[11:59:54] <joannac> wait.
[12:03:02] <joannac> trj: $elemMatch ?
[12:19:46] <monbro> in terms of performance, does we gain any when using $elemMatch to query a nested document compared without $elemMatch ?
[12:20:02] <monbro> do we, not does we :-)
[12:36:19] <AudienceWatching> hey guys I have a php aggregate Im trying to get working
[12:37:08] <AudienceWatching> heres the code and the errors include, http://textdump.net/read/2345/ , any help greatly appreciated
[12:53:23] <freddj> Hi, I have difficulties indexing a polygon crossing the 180th meridian (with the 2dsphere index)
[12:53:54] <freddj> I'm not sure if there is a bug in mongodb
[12:54:14] <Derick> hmm, when I tested that, it worked
[12:54:14] <freddj> or if I'm badly presenting the data to the index.
[12:56:38] <Derick> freddj: do you have a small demo script?
[12:57:06] <freddj> here is the polygon I'm trying to index: https://gist.github.com/fdejaeger/5796656
[12:57:17] <Derick> ok, let me try
[12:57:59] <freddj> My coordinates overflow -180 on purpose
[12:58:06] <Derick> yeah, that you can't do
[12:58:13] <Derick> you need to use 175 instead of -185 I think
[12:59:24] <freddj> but how can mongodb distinguish a small rectangle around the 180 th meridian from a large band going from -175 to 175 ?
[13:00:13] <freddj> orientation of the polygon ?
[13:00:47] <Derick> that is a very good question
[13:01:04] <Derick> freddj: I'm going to have to ask some people :-)
[13:02:00] <freddj> ok thanks!
[13:02:10] <freddj> I can file a bug if you need
[13:02:54] <Derick> that works too
[13:02:58] <Derick> i'll email hari though
[13:03:40] <Derick> I can include the jira ticket nr in the mail to draw his attention to it
[13:07:46] <Derick> freddj: let me know the number once you get it
[13:07:57] <freddj> yep, I'm filing it.
[13:19:11] <freddj> @Derick: Here it is https://jira.mongodb.org/browse/SERVER-9948
[13:20:19] <Derick> freddj: well, you can store l: [ feature1, feature2 ] and 2dsphere index l...
[13:20:24] <Derick> it's sort of a multipolygon
[13:23:07] <moian> Hi everybody
[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:28:25] <moian> anybody ?
[13:32:50] <moian> Derick: ?
[13:35:05] <Derick> moian: sorry
[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:54:58] <dariusz> Hi.
[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:56:17] <dariusz> That is in PHP
[13:56:28] <Derick> dariusz: AR
[13:57:04] <dariusz> ->distinct("cbsa", array('endDate' => array('$gte' => $myDateTimeVar)))
[13:57:22] <Derick> ->aggregate( array( '$match' => array( 'foo' => array( '$gte' => 42 ) ) ), array( '$groupBy' => array( '_id' => '$fieldname' ) ) );
[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.
[13:58:26] <Derick> dariusz: not, it doesnt :-)
[13:59:09] <dariusz> Derick: So why I've got distinct from whole collection, not limited by this date?
[13:59:24] <Derick> dariusz: with distinct or aggregate?
[14:00:28] <dariusz> With distinct
[14:00:28] <moian> gimpy7489: OK thank you!
[14:00:36] <Derick> dariusz: ... that's why i suggested aggregate :-)
[14:01:02] <Derick> ->aggregate( array( '$match' => array( 'endDate' => array( '$gte' => $myDateTimeVar ) ) ), array( '$groupBy' => array( '_id' => '$cbsa' ) ) );
[14:01:14] <dariusz> Ok, I will try :)
[14:02:44] <dariusz> Derick: Call to undefined method Doctrine\ODM\MongoDB\Query\Builder::agregate()
[14:02:55] <dariusz> by one and two g
[14:05:32] <dariusz> Can I use that on ZF2 queryBuilder?
[14:07:01] <Derick> heh, I don't know
[14:07:07] <Derick> I only do MongoDB/PHP stuff
[14:07:15] <Derick> if ZF2 doesn't support aggregate -> file a bug
[14:09:31] <dariusz> Ok, txh for help... unfortunately I can't use aggregate with ZF2/Doctrine query builder... You have any ideas use distinct?
[14:10:17] <dariusz> Because this example I've put above ignore this gte and take distinct from whole collection.
[14:25:09] <[AD]Turbo> does MongoDB handle the transition from -180 <-> 180 (longitude) and -90 <-> 90 (latitude) in geo queries?
[14:26:31] <Derick> yes, in queries it does
[14:26:48] <Derick> well, not -90 to 90
[14:26:51] <Derick> as that makes no sense really!
[14:27:06] <Derick> but near works around the poles as you'd expect
[14:27:31] <[AD]Turbo> so within box correctly handles transition betweend -180 and 180?
[14:27:58] <Derick> within is difficult, as how would it know which box to pick?
[14:28:19] <[AD]Turbo> you are right
[14:28:32] <Derick> you will have to do an OR I think for that
[14:33:18] <Number6> n06: There can only be one...
[14:33:38] <n06> Number6, well this is awkward...
[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:53:02] <Derick> (aggregate that is)
[14:53:09] <Derick> but distinct should also work...
[14:53:49] <Derick> dariusz: could it be that you have $myDateTimeVar as a string and not an int? MongoDB is sensitive to that
[14:55:13] <Number6> n06: I'm sure you've read http://mongodb.github.io/node-mongodb-native/driver-articles/anintroductionto1_1and2_2.html
[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:06:29] <Derick> dariusz: nope, sorry
[15:06:51] <Derick> dariusz: you can use some (as of yet) experimental debug interface in the driver I suppose...
[15:07:27] <dariusz> Ok, I will look for 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:19:37] <Derick> dariusz: that seems odd
[15:19:43] <Derick> like me ask the author
[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 :/
[15:44:24] <dariusz> any query I use..
[15:47:44] <dariusz> Ok guys, thx You both for help, I'm getting out
[15:48:00] <jmikola> i suggest taking a look at the testDistinctFieldQuery method in BuilderTest of doctrine/mongodb
[15:48:16] <jmikola> the feature definitely works; so perhaps you can use that to debug your use case
[15:48:24] <jmikola> or create a new, failing test case to submit in a pull request
[16:38:38] <jmikola> Derick: and grammar feedback on my blog article?
[16:38:43] <jmikola> oops, wrong window
[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:16:34] <n06> without adding auth
[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:19:48] <n06> im not entirely sure
[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
[19:56:20] <kali> http://www.huffingtonpost.fr/2013/06/17/lettre-allegeance-christine-lagarde-nicolas-sarkozy-twitter_n_3452666.html
[19:56:25] <kali> oups, not here :)
[23:19:50] <Nerp> is there a setup guide available for setting up a sharded mongo environment that doesnt use replica sets?