PMXBOT Log file Viewer

Help | Karma | Search:

#mongodb logs for Wednesday the 3rd of July, 2013

(Back to #mongodb overview) (Back to channel listing) (Animate logs)
[01:58:30] <SomeoneWeird> Is it possible to .find() a number of collections?
[01:58:39] <SomeoneWeird> like, the actual collections in the db, not items in them
[03:31:03] <stennie> @SomeoneWeird: i think you are looking for: http://docs.mongodb.org/manual/reference/method/db.getCollectionNames/
[04:17:47] <neeky> would a document that references itself for versioning purposes cause worm holes in the time-space continuum in a no-sql db?
[04:17:58] <neeky> like: so schema doc = {docid:string, old_docs:[doc]}
[04:18:34] <neeky> so when a user makes an edit, I copy the current version into old_docs, and make his edits to doc?
[04:19:06] <neeky> it makes my head hurt a bit, but seems logical
[04:32:44] <neeky> and embedding documents is certain;y fully supported in mongo, I'm thinking from a practical/logical standpoint vs technical
[04:41:45] <jihyun> TokuMX benchmark looks good, is there any plan to merge tokutek engine into mainline mongodb?
[07:33:40] <[AD]Turbo> ciao all
[09:01:58] <moian> Hi everybody!
[09:02:59] <moian> I'm trying to add an unique index on a sharded collection, with the shard key inside, and `dropDups: 1`
[09:04:16] <moian> During the process, the shards return errors like that: E11000 duplicate key error index: ng-store.ig_medias.$slt_1_mid_1 dup key: { : 408135, : \"459866786009510952_39181596\" }
[09:04:54] <moian> and finally it doesn't work
[09:05:37] <moian> With `dropDups: 1`, isn't it supposed to remove those duplicates and work fine ?
[09:14:39] <moian> Anybody ?
[09:32:02] <moian> ?
[09:41:15] <Nodex> ?
[09:43:06] <Nodex> dropDups removes or doesn't allow NEW duplicates
[09:46:48] <moian> Nodex: Yes, but if the collection already has duplicates, it is supposed to remove them at the index creation right ?
[09:48:23] <moian> Nodex: the fact is, the index creation doesn't work, I don't know why. All I got, is some errors `E11000 duplicate key error`
[09:49:55] <Nodex> No it's not, where did you red that it did?
[09:50:00] <Nodex> read*
[09:56:06] <moian> Nodex: here http://docs.mongodb.org/manual/core/indexes/#drop-duplicates
[10:00:29] <Nodex> really ?.... first line of that reads "MongoDB cannot create a unique index on a field that has duplicate values."
[10:00:56] <Nodex> which goes on to say "To force the creation of a unique index, you can specify the dropDups option, which will only index the first occurrence of a value for the key, and delete all subsequent values." ....
[10:01:24] <Nodex> meaning that it will index the first value and drop FUTURE attempts to add the value - it doesn't say it removes the current dupes because it doesn't
[10:01:30] <Nodex> (remove them)
[10:03:47] <moian> Nodex: what does `Warning Specifying { dropDups: true } will delete data from your database. Use with extreme caution.` mean then ? I don't understand what it removes
[10:07:28] <Nodex> means it will drop a dupe from your database when you try and insert it
[10:12:22] <moian> Nodex: I'm really convinced that it drops existing duplicates as well, as explained in this answer http://stackoverflow.com/a/5532074 (from Scott Hernandez), and many others
[10:22:15] <Nodex> ok, good luck :)
[10:24:15] <Nodex> if you believe that's the case then you probably have made the index wrong
[10:24:18] <Nodex> made/created
[11:21:58] <dmilith> why didn't you DESIGN mongo
[11:22:05] <dmilith> but it's grown piece of fucking crap
[11:22:07] <dmilith> ;f
[13:03:48] <AaronB> Hi. I'm trying to get replicasets and authentication to play nice. I've fired up three boxes with mongodb (keyFile specified), I've then added a 'root' user with readWriteAnyDatabase and dbAdminAnyDatabase, I authenticate as them and try to run any rs.* command but it fails with { "ok" : 0, "errmsg" : "unauthorized" }. Anyone got any ideas?
[13:12:08] <n06> Is there something wrong if it looks like i have 60-70 mongo instances running but i only started 1?
[13:12:11] <n06> this is in htop
[13:12:25] <n06> tehy all have different pids
[13:12:32] <n06> but they seem almost identicle
[13:16:21] <kali> n06: i don't know htop. i guess what you're seeing is the threads
[13:16:41] <kali> n06: check out a "ps auxwww"
[13:16:55] <n06> kali, thanks i think so too, i just changed the layout and its only showing my 1 process
[13:17:33] <jmar777> n06: ya... you can also try ps aux | grep mongod to list just processes
[13:17:37] <n06> 1 more question though: mongo will use all free memory on the system as its workspace, so what happens when there are more than 1 mongod instances running on 1 machine
[13:18:05] <kali> n06: they fight for memory
[13:18:23] <n06> kali, that sounds violent, and not particularly efficient
[13:18:43] <n06> is there a way to limit the amount of ram each on uses?
[13:18:44] <kali> n06: it sounds uglier than it really is... the kernel will optimize the use the same way than with one single big intance
[13:18:52] <n06> ok
[13:19:12] <n06> because i have 3 nodes on one machine, and one node seems to be eating much more memory than the rest
[13:19:26] <n06> im getting bad performance on this cluster and i think thats the cause
[13:19:39] <kali> the vsize you see is directly linked to the dataset size on disk
[13:19:51] <kali> what the kernel does is a bit tricy to investigate
[13:20:19] <kali> there are a few scripts around that could give you some insight though
[13:20:31] <kali> n06: http://eng.wish.com/mongomem-memory-usage-by-collection-in-mongodb/
[13:20:37] <n06> well its interesting, because i see the records in the collection as being evenly spread across the cluster, but one node has a tiny vsize and very little ram usage
[13:25:17] <n06> a cluster with 3 shards and 44 mil documents should be performing better than it is, im very confused by this
[13:28:20] <kali> n06: check the connection count
[13:29:01] <n06> kali, i can check that with serverStatus() right?
[13:31:14] <n06> { "current" : 40, "available" : 779, "totalCreated" : NumberLong(310) }
[13:35:17] <Beg_> is there a simple way of getting the name of a userid from a post?
[13:43:21] <Nodex> eh?
[13:43:44] <Nodex> Beg_ : that has to be the most vague question I have seen all week
[13:44:37] <Beg_> Nodex-> I was trying to reference a userid from a post to a collection of users
[13:44:56] <Beg_> however, I'll just go with the embedding, seems simple and the application will be lucky if it gets 1000 posts :>
[13:45:10] <n06> lol Nodex
[13:45:13] <Nodex> avoid referencing where possible
[13:45:23] <Nodex> it really isn't healthy ;)
[13:45:31] <n06> Beg_, I feel youre pain though, i just start assuming people know what i mean all the time :)
[13:49:16] <Beg_> hehe, well, mongo is new for me :)
[13:49:41] <Nodex> what you should take away form this is....
[13:50:07] <Nodex> how many times does a user's basic values change... (forename, surname, username, email)....
[13:50:17] <Nodex> (answer - little if ever)
[13:50:39] <Nodex> weigh that against a query for ever post against another collection (table) ;)
[13:50:57] <daslicht> is there a way to drop a db using node? I only found drop Collection
[13:51:08] <daslicht> is it possible at all ?
[13:52:23] <daslicht> something like this
[13:52:24] <daslicht> http://stackoverflow.com/questions/8857276/how-do-i-drop-a-mongodb-database-from-the-command-line
[13:52:27] <daslicht> but from node
[13:53:28] <Nodex> native node?
[13:53:43] <Nodex> https://github.com/mongodb/node-mongodb-native#primary-key-factories
[13:53:57] <Nodex> ... db.dropDatabase(function(err, done) {.....
[13:56:22] <saml> so are you regretting changing javascript engine to v8 now that spidermonkey has asm.js ?
[14:20:06] <Chammmmm> Hi, I am running on Mongodb 2.4.2 and I am trying to calculate the Working set with the metrics that you proposed.. The working set seems to be bigger(double the size) on the secondaries vs the primary? Is that an expected behavior?
[14:39:45] <perplexa> hello
[14:40:09] <perplexa> i think i discovered a minor bug in your php extension
[14:40:56] <perplexa> the pecl version that is, when you dump a mongoclient object, the connected property always says false :P accessing it works, tho. still a bit confusing
[14:51:47] <Derick> perplexa: what do you think it is?
[14:54:47] <perplexa> Derick: don't really know, but the result looks as followed: http://paste.perplexa.be/194
[14:55:55] <n06> whats the best diagnostic tool to find a bottleneck in a sharded cluster?
[14:59:11] <perplexa> Derick: the public property of the dumped object should match the dumped property itself ;p
[14:59:38] <perplexa> havn't tried if that has any negative impact on reflection classes yet
[15:00:18] <n06> when i run mongostat, i see that one shard (more specifically the primary in the replSet that is the shard) is write lcoked at 90% almost constantly, while every other shard is ok
[15:00:36] <n06> but the data is distributed evenly so i dont understand why that would happen
[15:06:42] <Derick> perplexa: can you file a bug report at jira.mongodb.org with a test script please?
[15:08:04] <perplexa> yep
[15:29:05] <klj613> hello - using the 'findAndModify' command. is it possible to update a field by using a different field? e.g. update 'date' with the current date + number of seconds which is in the 'interval' field?
[15:29:31] <Nodex> no
[15:29:32] <klj613> or would i have to use findAndModify (lock the record with a different field) then a update afterwards
[15:29:45] <Nodex> you can't reference the current document
[15:29:50] <klj613> ok thanks
[15:29:53] <kali> klj613: no. what you can do is optimistic locking. you pull a document, you change it, and use findAndModify to make sure it's still the same in the db
[15:30:34] <klj613> kali, thanks
[15:47:19] <Kosch> Hi, I get "can't find self in the replset config" error, when trying to initiate replset. The DB listens by default on 127.0.0.1:27017. Since the hosts don't see each other (connected by tunnels) I've just a set of ports. So e.g. the current DB is available on every host under 127.0.0.1:23. So I need to add as 1st member '127.0.0.1:27023' instead of
[15:47:19] <Kosch> 127.0.0.1:27017. Is the the cause for the problem?
[15:49:35] <Kosch> damn, seems so...
[15:52:25] <Chammmmm> nm.. found my issue.. dumps are causing the issue
[15:56:52] <perplexa> Derick: https://jira.mongodb.org/browse/PHP-864 - seems i can't properly format the code, tho. thought {{text here}} marks monospaced text ;/
[15:59:06] <perplexa> seems i can't edit it either ;p
[15:59:52] <Derick> it's ok, we'll fix it
[16:00:30] <Derick> perplexa: its {code} ... {code}
[16:00:38] <perplexa> oh :)
[16:00:58] <perplexa> looks much better, thanks for fix
[16:55:48] <jonaswouters> is the online training currently going still doable to pass if you missed the first 3 weeks of homework?
[17:02:34] <Beg_> I'm trying to aggregate all "jobs" based on date, the closest i have come to achieving my goal is, $addtoSet:"$_id", how would I add the whole row instead of just the $_id?
[17:22:25] <Nodex> look at projections beg_
[17:22:50] <Beg_> Nodex-> thanks
[17:42:47] <Beg_> Nodex-> I can't seem to figure it out.
[18:04:14] <Nodex> http://docs.mongodb.org/manual/reference/aggregation/project/
[18:08:37] <AndrewPD> Hey I have this python code that's supposed to remove a string called " u'==WRONG\n i' " from the array in the class field of the match field of the toothbrush field of the environments field of users, but it doesn't seem to change anything. Any idea what I might be doing wrong? http://pastie.org/private/eecf4kmzjlsrikcy1rgvw
[18:09:58] <Nodex> $pull will pull a key from an array
[18:10:08] <Nodex> it doesn't PULL a string from another string
[18:10:15] <Nodex> (INCASE YOU THOUGHT IT DID)
[18:10:21] <Nodex> caps / sorry
[18:10:48] <AndrewPD> Yeah, it's supposed to pull it from an array at the bottom.
[18:10:57] <AndrewPD> (The bottom of the data structure.)
[18:12:18] <Nodex> just check your collection on the shell.... mongo --may-- have escaped the \n to \\n
[18:13:47] <AndrewPD> This is the list I get back. [u'==WRONG\n i', u'==HELLO\n hi'], and trying to call the removal code with \\n instead of \n doesn't work either.
[18:15:28] <Nodex> what is "u" ?
[18:15:34] <AndrewPD> python unicode
[18:15:39] <Nodex> (I don't know python sorry)
[18:15:48] <Nodex> what does it look like from the shell?
[18:21:21] <Beg_> Nodex-> I figure it out.
[18:21:27] <Beg_> i cannot*
[18:22:37] <AndrewPD> I've actually just been using an open Python interpretter with pymongo imported as my shell. I have the mongo shell up now, though with the right DB. You want to know what the array looks like, right?
[18:33:39] <Beg_> Alright I figured it out I am the best I win!
[18:33:55] <AndrewPD> Actually, I think I have it. Thanks Nodex. The $pull is correct, but my functions for viewing and adding rules are not.
[18:34:09] <Beg_> I am not used to the concept of mongo, but I should just be more stupid and forget everything i once knew about sql.
[18:44:52] <n06> is there a reason that my cluster is inserting exponentially slower as the database fills up
[18:45:08] <n06> for the first 10 minutes of runtime i inserted 10 million documents
[18:45:19] <n06> for the next 20 hours i inserted a total of 40 million
[18:45:31] <n06> and everything grinds to a hald
[18:45:40] <n06> i checked the index size, and its under the size of RAM
[18:45:54] <n06> i feel like i have no more options
[18:45:57] <n06> ive tried everything
[18:48:16] <n06> does anyone feel like being my savior? I'll send you a pizza
[19:01:27] <n06> can you explain() an insert?
[19:05:16] <ehershey> 2.4.5 !
[19:06:31] <ehershey> n06: I don't think you can explain() an insert
[19:06:55] <ehershey> do you have complicated indexes?
[19:06:59] <ehershey> or a lot of them?
[19:22:20] <harenson> n06: send the pizza to ehershey xD
[19:27:29] <BrenCom> hi, looking for some support. have installed mongodb on Ubuntu 12.04 (aws ec2), I can run it in the console but when trying to run as a service it will not start
[19:28:06] <n06> ehershey, i dont have complicated indexes. I have exactly one index outside of the shard key and its a single combined index
[19:28:22] <BrenCom> I have ensured dir permissions and n file locking, not sure how to resolve. can anyone please assist?
[19:28:22] <n06> {domain: 1 suffix:1
[19:28:30] <n06> both of which are simple strings
[19:30:00] <lazrahl> Can the aggregation framework accept and use hints for index choice?
[19:30:40] <n06> is there a way to trace an insert like the way explain() works for cursors?
[19:30:56] <lazrahl> I see an open jira entry that mentions adding this feature...so I'm guessing no.
[19:35:25] <drag> Hey all. Currently writing a java application that interacts with mongodb. Do I have to synchronize the writes so that threading will be ok or will mongo take care of that for me?
[19:35:54] <n06> drag, the way i did it was to set up all writes to be atomic, that way everything is threadsafe
[19:36:08] <drag> n06, so mongo doesn't do it for me?
[19:36:33] <n06> you would basically just use the update command with the upsert flag
[19:36:56] <drag> n06, thanks, I'll look that up.
[19:36:59] <n06> http://docs.mongodb.org/manual/core/update/#crud-update-update
[19:37:36] <n06> sorry this one http://docs.mongodb.org/manual/core/update/#update-operations-with-the-upsert-flag
[19:38:06] <n06> i have 3 java services with 4 threads each and i dont have to worry thanks to upsert :)
[19:38:48] <BrenCom> n06: any advice on running mongodb as a service on Ubuntu?
[19:38:59] <n06> BrenCom, in what way?
[19:39:12] <BrenCom> have installed mongodb on Ubuntu 12.04 (aws ec2), I can run it in the console but when trying to run as a service it will not start
[19:39:12] <n06> it should work as advertised if thats what you mean
[19:39:34] <n06> well when you install mongodb it starts a service autmoatically so first run sudo service mongodb stop
[19:39:35] <BrenCom> it doesn't unfortunately, have been all over stackoverflow etc and tried everything
[19:40:17] <n06> what flags are you giving mongo when you set it up? like is it a replset or a sharded cluster or something special?
[19:40:23] <drag> n06, so if I create a map<string, object> and give that map to the BasicDbObject contructor, I can just use upsert as the name of one of the keys?
[19:41:05] <n06> drag, upsert isnt the name of a key, its an option within the update command
[19:41:51] <n06> so you would do something like update({/your stuff here/}, {upsert: true})
[19:41:52] <BrenCom> I am scriting new server deployment with RightScale, and am mounting a stripe set. immediately after installation I modify /etc/mongodb.conf to point to the mounted dir (/data/db) then call "sudo service mongodb restart"
[19:42:36] <BrenCom> n06: am not flagging it as anything special yet. just a simple installation
[19:43:25] <n06> hmm im not really sure what your problem is. I do know that when i start a mongod i use the --fork option because all of my instances are part of a replSet
[19:43:33] <n06> maybe that would work better for you?
[19:43:39] <n06> it does almost the same thing
[19:43:45] <BrenCom> --fork does work, I have tested it
[19:43:53] <BrenCom> does it make a diffeence?
[19:44:00] <n06> it will run the instance of mongod as a subprocess which means it will run in the background
[19:44:44] <n06> I'm not 100% sure if it makes a difference, if the only reason you're running as a service is to make it headless than i think its the same
[19:44:45] <BrenCom> is there any performance hit in doing it that way? why does the website documentation recommend service start for ubuntu instead of fork?
[19:45:24] <n06> BrenCom, I really couldn't tell you, but it probably has to do with efficiency on a process level
[19:45:35] <n06> i think you should be ok though
[19:46:08] <drag> n06, okay, I didn't come across this method the mongodb java tutorial. Currently, I create a new MongoClient object and connect with the appropriate options. Then I create a new DBCollection, then I insert using a BasicDBObject created from a map. How would I set the update option in this manner?
[19:46:42] <n06> update() is its own function, i would suggest checking out the java driver documentation
[19:46:58] <BrenCom> thank you n06, I'd like to exhaust all my options. does 10gen provide support on such issues?.
[19:47:17] <n06> BrenCom, couldn't tell you, i dont work for 10gen :) just anothe user
[19:47:35] <BrenCom> I know, just thought you might know :)
[19:47:47] <BrenCom> thanks for the advice anyway
[19:47:52] <n06> drag, http://api.mongodb.org/java/current/
[19:47:59] <n06> BrenCom, no worries, good luck
[19:51:44] <drag> n06, thanks. Out of curiousity, how do I do interact with the database in the manner you initially stated? There doesn't seem to be a method in collection which accepts a string.
[19:52:11] <n06> drag, not a string, a BasicDBObject
[19:52:43] <n06> http://stackoverflow.com/questions/10490205/mongodb-and-upsert-issue
[19:53:27] <n06> http://static.springsource.org/spring-data/data-mongo/docs/current/api/org/springframework/data/mongodb/core/MongoTemplate.html#upsert%28org.springframework.data.mongodb.core.query.Query,%20org.springframework.data.mongodb.core.query.Update,%20java.lang.String%29
[19:53:30] <drag> n06, I meant do something like this in java: db.bios.update(
[19:53:30] <drag> { _id:11, name: { first: 'James', last: 'Gosling' } },
[19:53:31] <drag> {
[19:53:31] <drag> $set: {
[19:53:31] <drag> born: new Date('May 19, 1955'),
[19:53:31] <drag> contribs: [ 'Java' ],
[19:53:33] <drag> awards: [
[19:53:35] <drag> {
[19:53:37] <drag> award: 'The Economist Innovation Award',
[19:53:39] <drag> year: 2002,
[19:53:43] <drag> by: 'The Economist'
[19:53:45] <drag> },
[19:53:47] <drag> {
[19:53:49] <drag> award: 'Officer of the Order of Canada',
[19:53:51] <drag> year: 2007,
[19:53:53] <drag> by: 'Canada'
[19:53:55] <n06> drag, use pastebin please, the bot will kcik you out
[19:53:55] <drag> }
[19:53:57] <drag> ]
[19:53:59] <drag> }
[19:54:01] <drag> },
[19:54:03] <drag> { upsert: true }
[19:54:05] <drag> )
[19:54:07] <drag> in that kind of format. Not possible?
[19:54:09] <drag> ok
[19:54:40] <drag> Is this kind of format not possible with the Java driver? http://pastebin.com/ens3VFWv
[19:54:54] <n06> no that will work
[19:54:58] <n06> look at the documentation
[19:55:09] <n06> you just have to make your BSON objects
[19:55:33] <drag> got it.
[19:55:58] <n06> heres a good example: http://www.pretechsol.com/2012/09/java-mongodb-upsert-example.html
[19:57:39] <drag> thanks again.
[20:10:55] <drag> n06, another quick question. Say I have a doc out there of: {_id: 1, text: "hi there"} and I want to replace it with {_id: 1, text: "hi there", text2: "you"}, I can use upserts and have it search for {_id: 1} and replace with {_id: 1, text: "hi there", text2: "you"}, correct?
[20:34:40] <Skunkwaffle> Does anyone know of a way to use a $regex inside the predicate of a $cond operation in the aggregation framework?
[20:35:09] <Skunkwaffle> I know you can't just drop it in, but I'm wondering if anyone knows somekind of hack, workaround, or anything else that allows this.
[20:35:20] <n06> drag, correct
[20:39:17] <Skunkwaffle> What I'm trying to do is count all the documents that contain a specific substring in one field. Which works using {'$sum': {'$cond': [ <predicate> , 1, 0]}}.
[20:39:29] <Skunkwaffle> but when the predicate involves matching against a regex, it doesn't
[20:43:41] <awpti> I'm confused. I'm doing: db.my_collection.find( { field1: val1, field2: val2 } ); with values that do not exist, yet it's returning records that don't match. What's the deal here?
[20:45:40] <Skunkwaffle> I'm counting some other things too so I cant just add it to a $match object earlier on, but I was thinking I could do some kind of $project trick to create a field I could check in the grouping later
[20:55:29] <awpti> http://pastie.org/8107912 for relevance in my above question
[21:07:22] <n06> I've lost all hope with mongo.
[21:07:36] <n06> I thought i could finagle high write throughput
[21:07:38] <n06> i was wrong.
[21:07:41] <n06> i feel defeated
[21:11:48] <dnsdds> I'm getting a "Access denied (5)" error while trying to install Mongo as a Windows service. And I am running cmd as an Administrator. What's up?
[21:28:07] <dnsdds> Nobody?
[21:58:56] <neeky> n06, what Filesystem, OS, etc?
[21:59:09] <neeky> your issue may be hardware tuning, not mongo
[21:59:56] <neeky> i don't know how big each of your documents is, but 40 million of anything is a lot
[22:33:05] <awpti> I could use some help here -- I feel I'm fundamentally misunderstanding something, but I'll be damned if I can work out what that is: http://pastie.org/8107912 (question is in the pastie with relevant data)