PMXBOT Log file Viewer

Help | Karma | Search:

#mongodb logs for Tuesday the 27th of May, 2014

(Back to #mongodb overview) (Back to channel listing) (Animate logs)
[00:12:39] <motaka2> hello is mongo really better in all aspects than mysql so that every new application must be written using mongo ?
[00:13:23] <jamesd> no, but do you use a sledge hammer to solve every problem, even if it is a powerful tool.
[00:13:55] <motaka2> jamesd: In what cases I must use mysql for example?
[00:14:46] <jamesd> when you need to do transactions... joins
[00:15:31] <jamesd> for many purposes mondgo is an excellent tool, but its not the only solution.
[00:15:39] <motaka2> jamesd: But we always need to join at leats
[00:16:00] <motaka2> least*
[00:16:30] <motaka2> for example can a CMS written using mongo + node.js ?
[00:16:33] <jamesd> no you don't... you can work around it, or you may not need them at all if your task is simple enough
[00:16:51] <jamesd> sure
[00:17:18] <motaka2> If I learn mongo can I simply find jobs in west ?
[00:17:59] <jamesd> possibly... but you probably need more than mongo
[00:18:47] <motaka2> I know mysql a lot better
[00:28:38] <cheeser> joins are definitely not necessary for a CMS
[01:19:17] <YuviPanda> ok, have a proper puppetized instance running 2.6 on wikimedia toollabs! Now to write a script that gives everyone an account...
[05:54:12] <norfrn> How would you index/query an array of arrays? It's an array of ranges that I need to check membership in.
[07:56:07] <KamZou> Hi, i'm trying to resync a replicaset member. The primary have a very large amount of updates and everytime the resync fail and my replicaset member stay in the "recovering" state. Any way to resync avoiding this comportment (without copying manually data from the sane one) please ?
[07:56:58] <joannac> umm
[07:57:48] <joannac> connect a mongo shell to your primary, db.printReplicationInfo()
[07:57:53] <joannac> KamZou: ^^
[07:58:01] <joannac> (and pastebin the result)
[07:59:20] <KamZou> joannac right now I've (re) started the replication (by stopping mongodb rsm stale member, cleaning up the data dir and starting again)
[07:59:39] <KamZou> Maybe I'll have the same result in 2-3 hours
[07:59:51] <joannac> depends how big the oplog is
[08:00:25] <KamZou> yes
[08:01:28] <KamZou> it's the usual time for this RS
[08:01:41] <KamZou> (these days)
[08:04:14] <joannac> can you take a fs snapshot?
[08:04:18] <joannac> or copy files instead?
[08:07:38] <KamZou> joannac can't copy files manually cause the goal is also to defragment disk space
[08:08:23] <KamZou> (with a resync from scratch)
[08:09:13] <joannac> ah
[08:09:26] <joannac> so what does db.printReplicationInfo() say on the primary?
[08:12:48] <KamZou> joannac http://pastebin.com/pVLQqLJk
[08:13:26] <joannac> ah, a race
[08:13:28] <joannac> 3.61 hours
[08:14:16] <KamZou> Hmm.. I'll have a large amount of queries in 3-4h
[08:14:35] <KamZou> I'll certainly have the same issue
[08:17:08] <KamZou> I think I'll have to (re)start the resync of that node on off hours
[08:18:12] <KamZou> or maybe is there some kind of parameters for this cases ? To catch every oplog during a resync ?
[11:30:14] <user55> Hello! I would like to ask two question related to mongodb:
[11:30:18] <user55> 1)
[11:30:26] <user55> I need to identify documents in a collection by an id number. The number should be:
[11:30:33] <user55> - unique, no other document should have it in the collection
[11:30:39] <user55> - permanent, should not change after update or at any other circumstances
[11:30:45] <user55> - should not be reused after the document is deleted
[11:30:50] <user55> Is mongodb's generated _id a solution for the problem?
[11:30:56] <user55> If not, what are the other possibilities?
[11:31:01] <user55> 2)
[11:31:06] <user55> Does mongodb support events/triggers?
[11:31:13] <user55> For example updating a document produce an event which triggers the execution of a function or external script.
[11:31:18] <Derick> the generated object id will work
[11:31:40] <Derick> there are no events or triggers, however, some tools (like meteor) will "tail the oplog" to do something like it
[11:31:49] <Derick> user55: it's better to do questions one by one :)
[11:32:47] <user55> thank you for the suggestion
[11:33:11] <user55> so _id will work fine..
[11:33:20] <kali> user55: ObjectId are unique when generated, so first and third criteria are met. the second is met too, because you can't update _id
[11:34:24] <kali> user55: that said, you can 1/ use ObjectId in other places than _id 2/ use whatever you want as your document _id
[11:36:51] <user55> well that was quick, thanks for the help!
[11:43:06] <inad922> hello
[11:43:43] <inad922> If I have a document in mongodb and I use the pymongo connector how can I add a new field to the given document type with a default value also set for that field?
[13:13:03] <djlee> Could someone tell me, are MongoId's represented in hex format, lexographically ordered by the time the id was generated. (i.e. if ordering alphabetically the hex string id's, will they be ordered by "creation timestamp"). Looking at some sample data, this seems to be true, but i only have a small sample size and i'm only comparing things by eye
[13:14:51] <cheeser> i really doubt that.
[13:15:02] <cheeser> why not just sort on _id order?
[13:18:41] <djlee> cheeser: just trying to work out some data feeds. We use redis for our feeds. Client has asked for a different kind of feed where we order by "likes", then order by creation timestamp for objects with teh same count of "likes". Problem is redis lexographically sorts keys with duplicate scores (in a sorted set), so i was kind of hoping that the lex ordering would just happen to nullify the issue. Looks like doing someth
[13:18:41] <djlee> ing a little more involved. Currently wandering down the lines of ZUNIONSTORE and messing with teh aggregation weights
[13:19:04] <djlee> but thats for the reply cheeser, at least i know i need to do something to make it happen, rather that it happening by luck/chance
[13:20:13] <djlee> thanks* for the reply (must learn to type correctly)
[13:20:39] <cheeser> np
[18:11:45] <dgarstang> I'm trying to build mongo on CentOS. I'm getting the following error... "Target 'build/linux2/ssl/use-system-all/usev8/mongo/mongod' depends on the availability of a system provided library for 'stemmer', but no suitable library was found during configuration."
[18:12:08] <dgarstang> I installed what I think is teh relevant package, perl-Lingua-Stem-Snowball, but that did not help.
[18:12:11] <dgarstang> Help. :(
[18:17:29] <mylord> how can i treat uid as a variable here (javascript): criteria = {"_id":new BSON.ObjectID(tid), "users.uid":{"$exists":true}};
[18:25:02] <jumanji> hi guys wondering how I can implement this in mongodb, or whether I should use a graph db instead. http://stackoverflow.com/questions/23896370/how-to-store-a-tree-structure-of-documents-json-and-access-each-parent-or-chil
[18:52:34] <dgarstang> I'm trying to build mongo on CentOS. I'm getting the following error... "Target 'build/linux2/ssl/use-system-all/usev8/mongo/mongod' depends on the availability of a system provided library for 'stemmer', but no suitable library was found during configuration."
[19:39:21] <tg2_> IndexRebuilder Fatal Assertion crash, any diea?
[19:51:37] <mylord> why can't I use $position with $each here? https://gist.github.com/anonymous/0a9a8fb77efa005e5ec8
[19:57:07] <mylord> alternatively, how can I added the most recently added (default is last?) element in an array or a subdocument?
[19:57:20] <mylord> array *in* a subdocument?
[19:57:54] <mattappe_> What is the best way to query mongo to see where a user is based on a DB of geo quadrants?
[19:58:12] <mattappe_> nearest location does not work well as you might not be at a location in our DB
[20:04:44] <tg2_> pastebin.com/9RD5eWXz
[20:04:50] <tg2_> any idea what this error is on startup?
[20:07:08] <Joeskyyy> mylord: What version of mongo are you on?
[20:07:31] <mylord> db version v2.4.3
[20:07:47] <mylord> how/should i upgrade? yum?
[20:08:06] <mylord> this is on my macbook dev machine
[20:08:22] <cheeser> homebrew++
[20:08:27] <tg2_> I see it tryign to open admin.ns and getting no such file or directory in strace
[20:08:31] <Joeskyyy> +1 to brew
[20:08:41] <tg2_> but it /was/ working before :|
[20:08:48] <tg2_> how did my admin db get lost?
[20:08:55] <Joeskyyy> mylord: $position was new to 2.6, hence why it's not working for it
[20:09:21] <mylord> why do i need to use $each to use $position anyhow? just curious
[20:09:44] <mylord> also.. if i can specifiy i want to update the last record in my array, then i don’t need to $push to $position:0
[20:10:06] <mylord> so how can i update to the last doc in an array subdoc?
[20:11:29] <mylord> aka: https://gist.github.com/anonymous/f2ddd9b0596fab84d69d
[20:11:40] <mylord> ^ how to update score in the last element in users "u1" array (or by last "joined")?
[20:12:06] <Joeskyyy> *shrugs* that's how the mongo folks made it I suppose?
[20:12:09] <tg2_> so is it normal not to have an admin table? :|
[20:24:13] <mylord> i think i might have installed mongo with port before.. do i need to uninstall it first before installing with brew?
[20:25:53] <therealkoopa> Is there a way to sort by introducing a modifying component? e.g. if you have views and likes on some object, you can sort on views or likes. But what if youw anted to sort on "likes * 1000 + views"
[20:28:23] <nicholasdipiazza> I was seeing tons of MongoCleaner threads when I called new MongoClient() every time I needed a connection. So I switched to a singleton. Is MongoClient() thread safe?
[20:28:57] <nicholasdipiazza> when i switced to the singleton, no more cleaner threads kept on spawning
[20:29:25] <nicholasdipiazza> but now i'm worried if i put this out on a load test, the load test will show threading race conditions or something
[20:39:38] <MonsieurApple> is there any type of redundancy when it comes to config servers? I had a box with a config server on it go down today and everything sort of halted, no new connections allowed
[20:42:48] <tscanausa> MonsieurApple: do you have multiple config servers?
[20:43:00] <MonsieurApple> yes, I have three
[20:43:04] <MonsieurApple> I was just looking at this more in depth
[20:43:10] <MonsieurApple> I turned off one of the config servers and everything was fine
[20:43:19] <MonsieurApple> maybe it was the fact that two replicas dropped as well
[20:43:35] <tscanausa> therealkoopa: you would have to use the aggregation framework
[20:43:42] <tscanausa> maybe
[20:43:48] <tscanausa> MonsieurApple: maybe
[20:43:56] <therealkoopa> tscanausa: That's what I'm seeing. Thanks
[20:44:43] <tscanausa> therealkoopa: no problem
[20:44:57] <tscanausa> nicholasdipiazza: which language?
[20:47:41] <mylord> how to debug this installation error ? https://gist.github.com/anonymous/051cf3800e5a0770f897
[20:48:23] <cheeser> i'd start by looking at where that file was actually installed
[21:01:16] <mylord> ya, but how?
[21:02:18] <mylord> nvm, works
[21:05:17] <mylord> ok, so why this error (after upgrading to mongo 2.6.1? https://gist.github.com/anonymous/368086c568958ee0fe5f
[21:05:34] <mylord> for this data: https://gist.github.com/anonymous/f2ddd9b0596fab84d69d
[21:27:18] <mylord> why? https://gist.github.com/anonymous/ea4964ac65611592454b
[21:36:15] <jason0_> Howdy all-- question about mongo. When using the mongo client-- are commands run in parallel on the backend. For example myCollection.find().count()?
[21:37:23] <jimpop> so... if you only need to do period db syncs, would you copy+clone+rename the collection, perform a whole db clone, use a replSet, or slaves?
[21:40:32] <therealkoopa> tscanausa: If I use aggregations, I see I can do: doctoredPageViews : { $add:["$pageViews", 10] }
[21:40:48] <tscanausa> maybe
[21:41:04] <tscanausa> I am not sure the structure you need
[21:41:15] <therealkoopa> Is it possible to say doctoredPageViews: {$multiply: ["$likes", 1000]} and then add pageViews?
[21:45:48] <therealkoopa> Ah, something like this seems to work: rank: { $add: [{$multiply: ["$like_count", 1000]}, "$views"] },
[21:46:49] <tafryn> Is there a way to find only documents with a specific key defined?
[21:48:54] <Joeskyyy> tafryn: You mean something like $exists?
[21:52:39] <tafryn> Joeskyyy: That's what I'm looking for. Thanks.
[21:53:30] <Joeskyyy> No prob (:
[21:59:46] <therealkoopa> If I use just $project in a db.foobars.aggregrate, things work.
[22:00:03] <therealkoopa> As soon as I add $limit, $sort, or $match, I get an exception " A pipeline stage specification object must contain exactly one field."
[22:00:13] <therealkoopa> I'm not sure I understand what it wants
[22:01:52] <Derick> therealkoopa: show the pipeline on a pastebin
[22:02:24] <therealkoopa> Derick: https://gist.github.com/anonymous/0498598102e3309e391c
[22:02:45] <Derick> ah
[22:02:49] <Derick> you need:
[22:03:58] <mylord> why do I get why "Unexpected token :" https://gist.github.com/anonymous/ea4964ac65611592454b
[22:03:58] <Derick> added a comment
[22:05:36] <mylord> ^ trying to add a “u1” to users at position 0 in this data: for this data: https://gist.github.com/anonymous/f2ddd9b0596fab84d69d
[22:06:00] <therealkoopa> Derick: Oh wow, okay. Thanks. I didn't realize you passed in an array. Totally overlooked that.
[22:06:16] <mylord> mongo doesn’t like the $aach key:values I have, but I don’t get how i’m supposed to only have the values and still make the update as intended
[22:06:29] <Derick> mylord: use quotes around '$each' and stuff
[22:07:31] <mylord> Derick: tried like this: > db.turnys.update({"_id":ObjectId("5384fe0d62ff8c4aee6d3eb1")}, {"$addToSet":{"users.u1":{"$each":[uid:"u2", "score":"4", "joined":new Date()], "$position":"0"}}})
[22:07:49] <mylord> same problem: SyntaxError: Unexpected token :
[22:07:52] <Derick> that's wrong
[22:07:59] <Derick> {"$each":[uid:"u2"
[22:08:08] <Derick> [ is for arrays, and not for objects. Arrays don't have keys
[22:08:34] <Derick> you *probably* want:
[22:08:59] <Derick> db.turnys.update({"_id":ObjectId("5384fe0d62ff8c4aee6d3eb1")}, {"$addToSet":{"users.u1":{"$each":[ { uid:"u2", "score":"4", "joined":new Date() } ], "$position":"0"}}})
[22:09:58] <mylord> Derick: that adds the record, but not adding to position 0
[22:10:04] <mylord> its still adding to the end of the array
[22:11:24] <Derick> that I don't know, sorry
[22:11:36] <Derick> maybe: '$position': 0 instead of "0"
[22:17:29] <mylord> Derick: no :/
[22:17:33] <mylord> didn’t work
[22:17:43] <mylord> how about how to modify the last element in an array?
[22:17:59] <mylord> as in update the score of the last “u1” in the u1 array?
[22:36:32] <NaN> hi there
[22:37:33] <NaN> my mongod was suddently closed, any clue? >> https://ghostbin.com/paste/3xj5v
[22:47:15] <tafryn> How do you make $exists part of a query in the monge-cxx-driver?
[22:48:34] <NaN> cxx driver?
[22:48:45] <NaN> oh! c++
[22:49:04] <NaN> tafryn: take a look here > http://api.mongodb.org/cxx/
[22:49:20] <tafryn> I'm in there already. Anywhere specific I should look?
[22:50:12] <tafryn> I'm tempted to say that the answer is not in there, but I could have overlooked something.
[22:56:35] <NaN> tafryn: have you tried with a BSON like query?
[22:57:25] <NaN> tafryn: http://api.mongodb.org/cxx/legacy-0.8.0/classmongo_1_1_d_b_client_connection.html#a87a9e8c0f219cf30a47530daf489224a
[23:03:13] <dgarstang> I'm trying to build mongo 2.6.1... and I'm getting "collect2: error: ld returned 1 exit status ... scons: *** [build/linux2/64/ssl/mongo/mongoimport] Error 1"
[23:10:37] <dgarstang> I'm trying to build mongo 2.6.1... and I'm getting "collect2: error: ld returned 1 exit status ... scons: *** [build/linux2/64/ssl/mongo/mongoimport] Error 1"
[23:27:55] <NaN> do you guys recommend me to use gridfs to store pdf (<10mb) files? or should I use the classic pattern of store only the path to the file?