PMXBOT Log file Viewer

Help | Karma | Search:

#mongodb logs for Wednesday the 11th of June, 2014

(Back to #mongodb overview) (Back to channel listing) (Animate logs)
[00:08:36] <dexterity> I use flask and mongoengine and every time I use model_form(Task) I get AttributeError: 'dict' object has no attribute 'iteritems'
[00:09:15] <dexterity> I use it like described here: http://docs.mongodb.org/ecosystem/tutorial/write-a-tumblelog-application-with-flask-mongoengine/
[01:05:52] <Gr1> Hi guys
[01:06:19] <Gr1> I was wondering why, dropping a database on a replica set is not reflecting on the secondary nodes
[01:14:20] <joannac> Gr1: interesting. it should
[01:14:33] <joannac> secondaries are up to date?
[01:18:14] <Gr1> Yep
[01:18:17] <Gr1> They are up to data
[01:18:19] <Gr1> *date
[01:22:14] <joannac> Can you find the drop on your primary mongod log?
[01:22:42] <joannac> if so, is there anything on the secondaries' mongo log to show it
[01:23:26] <Gr1> Nope it is not showing up on the secondary node logs
[01:23:37] <Gr1> joannac: Not sure what is going on
[01:23:55] <joannac> if you create a database right now and drop it, does that replicate?
[01:24:35] <joannac> a different database, i mean
[01:25:14] <Gr1> Checking joannac
[01:26:22] <dccc> hi folks, i'd like a second opinion on my data structure. i'm building a property management applications. i have 'buildings' and within, 'units' as an array of subdocuments. the 'listings' documents duplicate data from buildings and units to facilitate search. this doesn't seem very efficient to me. perhaps sql is better for this kind of data.
[01:26:57] <Gr1> Nope joannac
[01:28:46] <joannac> damn, he's gone :(
[01:31:44] <Gr1> I am also seeing some performance drop on some secondary nodes joannac
[01:32:07] <Gr1> The resident memory for mongod goes down after a write happened (even it is a small write)
[01:32:15] <Gr1> and faults start to appear
[01:32:34] <Gr1> this (I guess) results in the slow query
[01:32:48] <Gr1> Is there any tuning that I am probably missing?
[01:33:02] <joannac> Gr1: readahead?
[01:33:24] <joannac> Gr1: sounds like your replication is broken
[01:34:10] <Gr1> joannac: Data that I added on the master gets replicated to seondary nodes.
[01:34:26] <Gr1> It is that it results in slow queries.
[01:34:41] <Gr1> and resident memory goes down.
[01:35:03] <Gr1> Is there any way I can see if a reindexing is going on after replication, on each secondary node?
[01:35:05] <joannac> Gr1: but drops don;t?
[01:35:09] <Gr1> Nope.
[01:35:13] <Gr1> Drops don;t
[01:35:15] <joannac> wait, does the create db go through?
[01:35:25] <joannac> you could turn up logLevel
[01:35:36] <Gr1> Yep, create db goes fine though
[01:35:42] <Gr1> Ok, to debug level?
[01:35:53] <joannac> log level goes up to 5 i think
[01:35:56] <joannac> or maybe 6
[01:36:21] <joannac> setting it to 1 i think should be sufficient, maybe 2 to be sure
[01:36:53] <Gr1> Ok Thanks joannac. I will check this and see if I can derive on something.
[01:37:01] <Gr1> Thank you very much.
[01:37:35] <joannac> np, report back and let me know what the result is, I'm curious now
[01:38:16] <Gr1> Sure joannac
[01:56:42] <dman777_alter> I have for a field data : Number...but when I insert a string I don't get any complaints. Why is this?
[01:58:09] <joannac> what is meant to be enforcing that?
[01:58:12] <joannac> dman777_alter: ^^
[01:59:13] <dman777_alter> joannac: good question....I assume the database it self?
[01:59:57] <dman777_alter> joannac: using mongoose if that matters
[02:00:13] <dman777_alter> I guess it does :(
[02:00:20] <dman777_alter> becuase of the schema is where the type is
[02:08:18] <joannac> try #mongoosejs ?
[02:08:46] <joannac> mongodb server definitely does not enforce type
[09:12:51] <KamZou> Hi, is there a way to get the size of a given chunk please ?
[10:19:01] <rspijker> KamZou: a sharding chunk?
[10:19:18] <KamZou> rspijker, yes
[10:19:32] <rspijker> you can get average stats
[10:19:40] <rspijker> db.collection.getShardDistribution()
[10:19:43] <KamZou> cause i have one bigger than others
[10:19:56] <KamZou> and i get an error on a manual movechunk (too big)
[10:20:09] <KamZou> "chunk too big to move"
[10:20:20] <rspijker> I think there is a dataSize command as well...
[10:20:25] <rspijker> let me have a quick look at the docs
[10:20:40] <rspijker> http://docs.mongodb.org/manual/reference/command/dataSize/
[10:21:11] <rspijker> that should give tou the actual size of a chunk
[10:21:33] <rspijker> well, indirectly of course, by using the min and max shardkey values of the chunk in that command
[10:22:02] <KamZou> i'm trying thanks
[10:22:56] <rspijker> also have a look at this SO answer: http://stackoverflow.com/a/12470395/2156236
[10:34:51] <KamZou> rspijker, it sounds a bit tricky, and I use 2.4.8 version
[10:35:41] <KamZou> I'm looking for a way to detect error (the "chunk is too big to move" one) when I do a moveChunk
[10:35:56] <KamZou> To then splitchunk and retry
[10:45:02] <ed_saturn> hello, my mongo query on a replicated sharded cluster is slow if goes to mongos (route server), if query goes to replSet instance directly, everything is fine. any clue ?
[10:46:06] <Alan> ... well I joined to ask a question, but answered it myself
[10:46:07] <Alan> oops.
[10:46:38] <Derick> Alan: we're happy to be your rubber duck :-)
[10:46:57] <Alan> :D
[10:47:55] <Alan> (I was trying to figure out how I'm supposed to go from a full mongodb URI to the database it refers to - answer is MongoClient(uri).get_default_database())
[10:50:45] <Alan> (in the pymongo driver)
[10:51:41] <rspijker> KamZou: just wrap the move function with your own and add some error handling for that? If it occurs perform a split?
[12:21:39] <Rocketuncle> Hii
[12:22:28] <Rocketuncle> i need some help regarding mongodb
[12:22:38] <Rocketuncle> can anybody help me?
[12:28:52] <joannac> Rocketuncle: just ask your question
[12:29:40] <Rocketuncle> hey it is a server problem
[12:30:09] <Rocketuncle> MMS SSUPPORT-3466
[12:30:44] <Rocketuncle> cann u please look at this issue
[12:31:33] <Rocketuncle> @joannac r u from mongodb support team?
[12:35:19] <dragoonis_> I'm trying to back up a collection before I do some processing on it. I'm using db.collection.copyTo() but it's doing an eval underneath and LOCKING everything, so all reads are locked too. How can I back up a collection and have it not lock the mongod connection ?
[12:37:59] <Derick> mongodump should work
[12:41:21] <dragoonis_> hey Derick I'm in PHP land right now, using the extension - I'm doing Mongo::execute("function(){ db.$from.copyTo('$to') }", array('nolock' => true));
[12:41:36] <dragoonis_> it's totally locking despite nolock => true
[12:42:37] <Derick> dragoonis_: execute is your eval issue
[12:42:47] <Derick> you want to run the command yourself
[12:43:09] <dragoonis_> Derick, using which Object::method ?
[12:43:20] <Derick> MongoDB::runCommand
[12:43:22] <dragoonis_> roger
[12:43:31] <Derick> but I know see, that copyTo in the shell, is just a loop...
[12:43:58] <dragoonis_> Derick, the docs says that copyTo() uses eval() underneath
[12:44:14] <dragoonis_> I see db.cloneCollection(), no mention of locking here.
[12:44:19] <dragoonis_> http://docs.mongodb.org/manual/reference/method/db.cloneCollection/#db.cloneCollection
[12:44:30] <Derick> yeah, that's something else
[12:44:33] <Derick> copyTo is a shell thing
[12:45:23] <Derick> dragoonis_: I think you'll just have to loop it yourself. Write a script that does a find() without query, and write each entry to the new collection
[12:45:34] <Derick> that's not great though...
[12:45:45] <Derick> for backup purposes, use mongodump on the shell
[12:45:48] <joannac> Rocketuncle: your ticket has visibility. Someone will post an answer soon.
[12:46:08] <joannac> hi Derick :)
[12:46:21] <Derick> hi joannac
[13:21:55] <cozby> mongo documentation talks about snapping EBS often (on AWS of course), but snapping an EBS requires that disk be in a static state, and no writes are taking place
[13:22:37] <cozby> so I'm guessing that one must remove a replica instance from a replica set, then snapshot the ebs volume, then re-attach
[13:22:54] <cozby> ugh
[13:23:14] <cheeser> you can issue a file lock (flock?) on a node, iirc.
[13:23:19] <Derick> cozby: no, you can use fsync and lock I think
[13:23:20] <cheeser> not sure how advisable that is...
[13:23:24] <cheeser> that's it.
[13:24:22] <Derick> http://docs.mongodb.org/manual/reference/method/db.fsyncLock/
[13:25:09] <Derick> cozby: http://docs.mongodb.org/ecosystem/tutorial/backup-and-restore-mongodb-on-amazon-ec2/ should have everything you need
[13:25:25] <cozby> mm cool, thanks
[13:30:28] <cozby> here's what I'm trying to do (let me know if its silly) - Have my replica set in an autscaling group, so if one instances goes down a new one comes up, this new instance startup will pull the mongo files from a mongodump I take daily and store on an s3. The new instance will copy the dump data and will be able to sync with the replica set again.
[13:31:09] <cozby> right now I'm configuring the dumping and re-importing piece
[13:31:41] <cozby> if a new instance is launched the data will be too stale, hence me copying the daily data dump at boot
[13:31:52] <cheeser> you still run the risk of the sync being too far behind.
[13:35:25] <cozby> cheeser: hmm I reckon its 24 hours
[13:35:36] <cozby> so perhaps I bump my daily snapshots to every 8 hours
[13:35:53] <cozby> (am I being too paranoid here?)
[13:36:51] <joannac> if you're on EBS, why don't you take EBS snapshots?
[13:37:41] <cheeser> +1
[13:37:43] <cozby> joannac: hmm yes I could
[13:37:45] <joannac> oh, that was already linked. good
[13:37:52] <joannac> hi cheeeeeser
[13:37:58] <cheeser> 'sup, joannac ?
[13:38:10] <joannac> cozby: PM
[13:38:12] <joannac> oops
[13:38:14] <joannac> cheeser: PM
[14:17:44] <pstk> hello
[14:17:57] <pstk> i'm a new user of mongodb
[14:18:28] <pstk> anyone has try to work here with etherpad ?
[14:23:08] <saml> yes
[14:23:20] <saml> what is etherpad?
[14:23:34] <saml> etherpad uses mongo?
[14:25:47] <pstk> http://etherpad.org/
[14:25:57] <Joeskyyy> I love etherpad.
[14:26:12] <pstk> etherpad uses all databases
[14:27:01] <pstk> Joeskyyy: do you use etherpad with mongodb?
[14:30:05] <Joeskyyy> How do you mean?
[14:30:54] <Joeskyyy> Ah, you mean as the backend store. I can't say actually, something I don't control
[14:31:49] <pstk> ok
[14:32:12] <pstk> i have to create 'role' before create an 'user' on mongodb?
[14:44:26] <rspijker> pstk: there are standard roles for 2.6 as well
[14:47:52] <pstk> rspijker: ok, how can i see them ?
[14:48:05] <rspijker> pstk: documentation: http://docs.mongodb.org/manual/reference/built-in-roles/
[14:49:21] <pstk> oh nice thx
[14:50:53] <saml> so how can I update 1000 docs at once? updated values aren't constant
[14:51:23] <saml> i have a collection with urls. i want to update "view counts" of each url.
[14:51:37] <saml> right now, i'm doing one update per document in a loop
[14:52:11] <Derick> yes, that's what you have to do
[14:52:15] <saml> for id in ids { collection.update({_id: id}, {count: count[id]}) }
[14:52:22] <saml> thanks
[14:52:24] <Derick> no
[14:52:39] <Derick> that will overwrite each document with just the count
[14:52:45] <saml> i mean $set
[14:52:52] <Derick> for id in ids { collection.update({_id: id}, { '$set': { count: count[id]}) } }
[14:52:55] <Derick> ok then :-)
[14:52:56] <saml> yah
[14:53:03] <saml> but i need transaction
[14:53:21] <saml> all those 1000 documents need to be updated at once preferably
[14:53:34] <Derick> there is no such thing as a transaction
[14:53:56] <saml> so while first hundred is updated, app goes down
[14:54:12] <saml> not goes down. but responds with empty result
[14:54:30] <Derick> way around this is to do this:
[14:54:39] <Derick> do a query fetching the count for all of them
[14:54:45] <Derick> then in each loop iteration:
[14:54:59] <Derick> for id in ids { collection.update({_id: id, count: old_count[id]}, { '$set': { count: count[id]}) } }
[14:56:15] <saml> the app queries like this: var date = coll.find().sort({date:-1}).limit(1)[0].date; coll.find({date: date})
[14:56:50] <saml> and the update script is doing coll.update({_id:id}, {$set:{count:count[id], date: new_date}})
[14:56:52] <saml> in a loop
[14:57:24] <Derick> so you can use the old date in the update's query then?
[14:57:32] <saml> the loop doesn't take too long to run.. if i refactor the script so that there's only one loop
[14:57:48] <Derick> for id in ids { collection.update({_id: id, date: old_date}, { '$set': { count: count[id], date: new_date}) } }
[14:58:00] <saml> but actually, it's talking to omniture. get the counts. do the loop. talk to different service. do different loop.. so the whole script takes 10 minuets to run
[14:58:13] <saml> and during 10 minutes, the app's query returns empty
[14:59:02] <saml> Derick, not sure what {_id:id, date:old_date} makes difference
[14:59:16] <saml> what difference it makes
[14:59:30] <saml> there's one document with a given id
[14:59:45] <saml> i want to update the document with new count and new date
[14:59:51] <Derick> yes
[15:00:06] <Derick> but by checking for the old_date, you can run it multiple times without problems
[15:00:18] <saml> it's not really mongodb. i just need to refactor the script so that it collects counts from various services. and do the update in one loop
[15:00:21] <Derick> (that one single update query really)
[15:00:48] <saml> or fix the app's query
[15:01:10] <saml> coll.find({date: new_date}) this is bad (app's query)
[15:02:01] <saml> let's say script updated one document. new_date is updated. so the app tries to find({date: new_date}), which returns single document only
[15:03:21] <saml> probably app should do coll.find(date < now and date > (now - 24hr))
[15:04:02] <saml> instead of finding the lastest "date" in coll and do coll.find(date == latest_date_found)
[15:36:58] <Shakyj> Hey, I am thinking on storing google ranking data in MongoDB, just trying to think of my structure, access will be mainly keyword then domain based so I came up with this structure https://gist.github.com/anonymous/60ed1fef3184b5134226 but would that allow me to sort the rankings by date? If so how?
[15:38:06] <Derick> do not store it like that
[15:38:19] <Derick> never use values for keynames
[15:38:33] <dragoonis_> string(60) "renameCollection may only be run against the admin database."
[15:38:49] <dragoonis_> When I run it against 'admin' I get: string(47) "invalid collection name: answer_to_response_map"
[15:39:30] <dragoonis_> 'answer_to_response_map' is the TO part, so of course it doesn't exist, I'm trying to rename it to that
[15:39:30] <Derick> hmm, I have seen that before
[15:39:39] <Shakyj> Derick: How would I be better doing it then?
[15:39:44] <Derick> one sec
[15:39:51] <Shakyj> :)
[15:41:21] <Derick> added a comment
[15:41:56] <joshua> Is there an easy way to get just inserts from db.currentOp
[15:44:57] <dragoonis_> Derick, logpath = /usr/local/var/log/mongodb/mongo.log
[15:45:03] <dragoonis_> will this contain like a "query log" too ?
[15:46:43] <Shakyj> Thanks Derick I will just now have to pour over the docs to find how to best query it :D
[15:47:41] <Derick> dragoonis_: the "slow" query log"? yes
[15:47:45] <Derick> there is only one log file
[15:48:06] <dragoonis_> Derick, roger, i fixed it.
[15:48:09] <dragoonis_> return $this->getMongoAdminDatabase()->command(array('renameCollection' => $from, 'to' => "$dbName.$to"));
[15:48:19] <dragoonis_> I wasn't specifying 'dbName' so it was erring
[15:48:22] <dragoonis_> erroring *
[15:48:35] <joshua> dragoonis_: http://docs.mongodb.org/manual/tutorial/manage-the-database-profiler/
[15:48:38] <Derick> what does getMongoAdminDatabase do?
[15:49:05] <dragoonis_> Derick, returns me a MongDB object against the 'admin' DB
[15:49:21] <dragoonis_> I'm glad i figured that one out :)
[15:49:21] <Derick> yeah, can I see that code? :-)
[15:49:53] <dragoonis_> Derick, https://gist.github.com/dragoonis/e9a89c42b7517e42a141
[15:50:14] <dragoonis_> I'm using the Doctrine\Mongo component wrapper here
[16:35:43] <ed_saturn> arrgh, still stuck with performance degrade with mongos :/
[18:10:01] <sweb> is there any guide for add `fa` Persian language for fulltext search support
[18:10:08] <sweb> stop words and etc ...
[18:24:58] <ForSpareParts> Is there a way to retrieve only part of a Mongo document? I anticipate specific pieces of my documents getting huge, but it’s important I be able to get their top-level attributes without pulling down loads of data every time.
[18:25:11] <ForSpareParts> I’m using Mongoose, and I’m a total noob. Sorry if this is a stupid question.
[18:28:33] <cheeser> ForSpareParts: http://docs.mongodb.org/manual/reference/method/db.collection.find/#projections
[19:01:17] <gsd> which is faster, one query with 100 $ors or 100 individual finds
[19:02:16] <kali> gsd: une query will probably be faster (because you'll have much less network overhead)
[19:02:29] <kali> s/une/one/
[19:04:10] <gsd> thanks
[19:05:44] <cppiii> anyway to replicate data from mongodb to mysql?
[19:06:10] <kali> cppiii: arf. no. :)
[19:07:24] <cppiii> kali: I see, then cron job is a solution?
[19:08:29] <kali> cppiii: i think you're confused somewhere. mongodb and mysql have totally different data models
[19:12:13] <cppiii> kali: yes, but what I want is reading the updated data from mongodb and insert them into mysql with different schemes
[19:16:49] <kali> cppiii: you'll have to do this on top of the mongodb driver, in your application
[19:21:02] <saml> coll.find({date:date}).sort({count:-1}).limit(10); vs. coll.find().sort({date:-1,count:-1}).limit(10); what's better?
[19:21:37] <saml> in the first one, date value is from coll.find().sort({date:-1}).limit(1)[0].date
[19:23:12] <saml> find({date: mostRecentDate}).sort({count:-1}) vs. find().sort({date:-1, count:-1})
[19:32:36] <cppiii> kali: ok
[19:35:52] <kali> saml: provided that you have a composite index on date and count, it should be more or less equivalent
[19:37:02] <saml> yup
[19:37:45] <saml> mongodb queries are hard to read and write
[19:38:30] <saml> but it's alright. i don't write queries much :P
[19:38:47] <cheeser> jsbeautifier.org
[20:05:26] <NaN> why does $unset update to null? ex: $unset: { array.pos: "" } >>>> turns null in pos
[20:06:35] <NaN> foo.4 = { somedoc } ... $unset: { foo.4: "" } ... foo.4 = null
[20:06:56] <cheeser> what are you expecting to happen there? that that position would vanish entirely?
[20:07:19] <NaN> cheeser: yes sr
[20:07:23] <cheeser> try $pull
[20:07:40] <NaN> $pull: { foo.4 : true }
[20:07:41] <NaN> ok
[20:09:00] <cheeser> i was thinking you'd use somedoc but if that works for you...
[20:09:18] <NaN> cheeser: how do I tell $pull the position on the array?
[20:11:14] <cheeser> you ahve the document you're wanting to remove, just pass that with $pull
[20:45:25] <diphtherial> i'm not sure if this is a commonly-asked question, but just to verify there isn't guarantee of atomicity when updating multiple documents, right?
[20:46:15] <diphtherial> *any guarantee
[20:46:23] <cheeser> there is not
[20:47:01] <diphtherial> i was reading a bit about tokumx, which apparently offers transactions; what's the opinion about it here?
[20:47:18] <diphtherial> (the transactions unfortunately aren't going to work for us, since we're using mongodb with shards)
[20:59:17] <kali> diphtherial: i'm messing around with an alternative approach, if you want to have a look and comment... https://github.com/kali/extropy
[21:11:56] <diphtherial> kali: interesting! i'll read it in more depth in a moment
[21:17:28] <cozby> I'm trying to access the webconsole via curl
[21:17:34] <cozby> it works when I access it using localhost
[21:17:41] <cozby> but when I use the IP says -- not allowed
[21:17:51] <cozby> looking at the headers there's some sort of basic auth enabled
[21:18:00] <cozby> where is this configured?
[21:18:19] <cozby> there's auth and authorization options in the conf file
[21:18:34] <cozby> what username/password do I use
[21:18:40] <cozby> I can't find where this is configured
[21:18:54] <cozby> in my mongo.conf there's nothing regarding username/password
[21:21:04] <cozby> hmm so its the auth flag
[21:21:40] <ForSpareParts> How do you represent an arbitrary dictionary in a Mongoose schema? Something where the keys don’t have any special meaning, and they’re just used as an index to a model.
[21:22:15] <ForSpareParts> Like this: http://hastebin.com/kohapivige.json
[21:23:28] <ForSpareParts> In schema terms, there’s nothing special about the names ‘somewidget’ and ‘otherwidget’, they’re just how widgets are identified. But I don’t see a structure like that in Mongoose, so I’m assuming I should be doing something else — maybe making the name/id part of the widget somehow, and representing “widgets” as a list of objects...?
[21:52:33] <iforionf> test
[22:57:40] <Jadenn> hiya. so i'm having an issue with sorting, i need to retrieve the newest records, which is fine, but it's not letting me sort again so they are in the right order.
[23:02:28] <leon> Hi,
[23:02:56] <Guest92688> any one already got a situation where the mongos stop no answer mid connection on connections to localhost duo to load?
[23:03:28] <Guest92688> looks like some system limit
[23:04:10] <Guest92688> Any one?L
[23:05:52] <NaN> cheeser: still couldn't do $pull with index. ex: { foo: [{},{},{}] } < I would like to remove the 3rd {} something like $pull: { foo.3: true } ...any clue?
[23:06:33] <Jadenn> i guess i just had to apply a skip. works for me :P
[23:24:45] <b1nd3r> Hello. If my docs have boxes recorded inside a field, how can I search in mongo which boxes (docs) a point belongs too?
[23:27:18] <NaN> what's boxes recorded inside a field?
[23:31:06] <b1nd3r> NaN: a box, with a bottom left coordinates and an upper right coordinates inside my "bounds" field and type "Box". They represent a box in a map, how can I take a point and search in my database which boxes this point is inside of?
[23:33:23] <NaN> oh a geo 2d field
[23:33:40] <partycoder> i have a question
[23:34:13] <partycoder> if i wanted to have a pool of documents
[23:34:24] <partycoder> with certain structure
[23:34:27] <b1nd3r> NaN: if I record points I can use $geoWithin : { $box ... but in this case is the inverse
[23:34:59] <partycoder> as an optimization with respect to inserting a new one
[23:35:23] <partycoder> like, a pool of documents representing blank user records
[23:35:43] <partycoder> that then get assigned to each user
[23:35:57] <partycoder> what do you think about that
[23:36:56] <partycoder> of course you cannot re-key the document, which is unfortunate
[23:37:09] <partycoder> but disregarding that thing
[23:39:30] <b1nd3r> NaN: should I use $geoIntersects ?
[23:39:58] <NaN> b1nd3r: man I had never used geoJson with mongo so don't trust me with that hehe
[23:40:55] <b1nd3r> NaN: okay lol