PMXBOT Log file Viewer

Help | Karma | Search:

#mongodb logs for Monday the 22nd of April, 2013

(Back to #mongodb overview) (Back to channel listing) (Animate logs)
[01:44:20] <j83> After I added in the $match object, I'm now getting an Unexpected Identifier error. I cannot seem to correct it. Also is this proper usage of $project? For some reason I cannot get the $unwind and $group to work with "$alerts.name" unless I alias it through $project.... http://pastebin.com/Z6z40ay1
[02:27:01] <someprimetime_> i'm doing a reset pw functionality and curious if i should create two collections for it (one for storing the entry of the pw reset action) and then setting a boolean within the User schema to `reset: true..current algorithm: http://pastebin.com/21he4E2j
[03:01:57] <j83> hellooo
[03:23:06] <ehershey> /1
[03:23:10] <ehershey> oops
[05:39:37] <pringlescan> I'm using MongoDB 2.4.1. I'm inserting 624k documents, with safe and w:1 using the Node.JS driver. That works, the callbacks are fired as the inserts occur. Immediately after that from the same app, I insert another 250,000 documents into a different collection (same database). This time, NONE of the callbacks fire.
[05:39:53] <pringlescan> The documents are being inserted, for the first 43k [same number every time], then it stops for a minute or so, then it starts inserting at 11,000-13k a second according to MongoDB's stats, and then all the callbacks fire, including the 43k that hadn't fired before.
[07:41:54] <[AD]Turbo> hi there
[08:22:56] <kali> git diff
[08:23:03] <kali> mmmm, no, not there
[08:42:58] <Nodex> lmao
[09:03:19] <alcuadradoatwork> I'm lost with something about map-reduce.. I must be misunderstanding something
[09:03:31] <alcuadradoatwork> I made the most trivial example on earth, and don't understand the results
[09:03:37] <alcuadradoatwork> http://pastie.org/private/alaemodllssd5z9noolfug
[09:04:08] <alcuadradoatwork> how can I get an ISODate in a value if my reduce function always return 1?
[10:03:50] <Nodex> ding a ling
[11:37:50] <sinclair-linux> hey guys
[11:37:54] <sinclair-linux> i have a rather simple question
[11:38:11] <sinclair-linux> how do i start mongo ?
[11:38:18] <sinclair-linux> i understand that i can use...
[11:38:40] <sinclair-linux> mongod --dbpath /data/db --port 12345 for example
[11:39:01] <sinclair-linux> however, i am wanting to start mongo remotely, (on a remote linux server)
[11:39:17] <sinclair-linux> what do i need to do to ensure mongo stays running when i log out?
[11:39:26] <Nodex> an init script
[11:39:39] <Nodex> how did you install mongo ?
[11:40:14] <sinclair-linux> um, sudo apt-get mongo
[11:40:27] <Nodex> false
[11:40:30] <Nodex> apt-get install mongo
[11:40:36] <Nodex> mongodb-10gen *
[11:41:23] <sinclair-linux> yes yes
[11:41:25] <sinclair-linux> i did that
[11:41:27] <Nodex> which linux distro ?
[11:41:33] <sinclair-linux> ubuntu
[11:41:42] <alcuadradoatwork> it should start automatically
[11:41:47] <Nodex> service mongodb start
[11:42:00] <sinclair-linux> Nodex: what about parameters like port etc?
[11:42:10] <Nodex> edit your /etc/mongodb.conf file
[11:42:22] <sinclair-linux> ok, let me give that a go
[11:43:37] <alcuadradoatwork> does a simple {$project: {name: "$_id"}} in an aggregation takes O(n) time?
[11:43:56] <alcuadradoatwork> or is it smart enough to just change a string?
[11:43:59] <sinclair-linux> Nodex: is it mongod or mongodb i should be starting?
[11:44:07] <Nodex> d
[11:44:17] <Nodex> ls -alsh /etc/init.d/mongo*
[11:50:23] <sinclair-linux> Nodex: it says the service is already running
[11:50:58] <sinclair-linux> Nodex: looking in the mongodb.conf, it says it is bound to 127.0.0.1 on port 27017
[11:51:09] <sinclair-linux> im trying to connect to that, and not having much luck
[11:53:46] <Nodex> how are you trying to connect to it?
[11:54:00] <sinclair-linux> using a PHP client
[11:54:14] <sinclair-linux> ignoring the PHP part for a second
[11:54:20] <Nodex> first off check it's running
[11:54:25] <sinclair-linux> it seems to be
[11:54:36] <sinclair-linux> mongostat looks like its listening to it
[11:54:38] <Nodex> on your terminal type ongo
[11:54:42] <Nodex> "mongo"
[11:54:46] <Nodex> and press enter (no quotes)
[11:55:22] <sinclair-linux> MongoDB shell version 2.0.4 connecting to test:
[11:55:28] <sinclair-linux> now i have a prompt
[11:55:31] <Nodex> show dbs
[11:55:38] <Nodex> (the enter)
[11:55:43] <Nodex> yuo should get a DB list
[11:55:49] <sinclair-linux> local (empty)
[11:56:06] <Nodex> ok. on your php script do var_dump(new MongoClient());
[11:56:23] <sinclair-linux> why?
[11:56:30] <sinclair-linux> what will that do?
[11:57:18] <Nodex> err lol really?
[11:57:35] <sinclair-linux> i know what it does, but what is it going to acheive?
[11:57:36] <alcuadradoatwork> sinclair-linux, he is trying to hack you! beware!
[11:58:15] <Nodex> ok good luck :)
[11:58:41] <alcuadradoatwork> it would show the parameters of the mongoclient and a bunch of stuff more
[11:59:03] <alcuadradoatwork> is it ok to use a document as keys for a mapreduce?
[11:59:10] <sinclair-linux> ok, hang on
[11:59:41] <alcuadradoatwork> if not, how can I count the number of documents that are identical except for their _id?
[11:59:49] <sinclair-linux> Nodex: note tho, im not sure i know why i would need to tinker with php mongo client/driver, its connected successfully to other stuff
[12:00:22] <sinclair-linux> including a mongo instance on this very machine, when i run the command...
[12:00:35] <sinclair-linux> mongodb --dbpath /asda/ --port 12345 for example
[12:00:45] <sinclair-linux> the problem isn't the PHP client is what im saying
[12:02:41] <sinclair-linux> Nodex: ...
[12:02:43] <sinclair-linux> fine
[12:03:11] <Nodex> ?
[12:03:13] <alcuadradoatwork> sinclair-linux, the fuck are you talking about?
[12:03:26] <alcuadradoatwork> you said you had a mongo server running
[12:03:32] <alcuadradoatwork> then, your problem is in the client
[12:03:40] <alcuadradoatwork> and your client is php
[12:03:59] <sinclair-linux> alcuadradoatwork: sorry, im not here to be cursed at, ill figure it out on my own
[12:04:30] <alcuadradoatwork> I think you are just trolling him
[12:04:36] <sinclair-linux> stfu
[12:05:06] <Nodex> you asked how to start your mongod - which I told you
[12:05:46] <Nodex> you started to question why I was asking you to test things which I don't have time for and am not interested in discussing. You can either accept help or not - choice is yours
[12:06:03] <Nodex> oh he left lol
[12:06:06] <alcuadradoatwork> he left, lol
[12:06:13] <Zagdul> hi everyone...
[12:06:22] <alcuadradoatwork> I think he was trolling you Nodex
[12:06:29] <Nodex> yer it would seem that way
[12:06:29] <alcuadradoatwork> Hi there Zagdul
[12:07:01] <Zagdul> i thought I'd try to ask my question here as google group did not work out
[12:07:03] <Zagdul> ;-)
[12:07:32] <Nodex> Zagdul : best to just ask
[12:07:59] <Zagdul> when trying to write with W=4 it always ends in a timeout
[12:08:43] <Zagdul> hi1:PRIMARY> db.testreplication.insert({_id:new Date()});printjson(db.runCommand({getLastError:1, w:4, wtimeout:18000}));
[12:08:57] <Zagdul> {
[12:08:57] <Zagdul> "n" : 0,
[12:08:57] <Zagdul> "lastOp" : Timestamp(1347958085000, 25),
[12:08:57] <Zagdul> "connectionId" : 431946,
[12:08:57] <Zagdul> "wtimeout" : true,
[12:08:58] <Zagdul> "waited" : 18000,
[12:08:59] <Zagdul> "err" : "timeout",
[12:09:01] <Zagdul> "ok" : 1
[12:09:03] <Zagdul> }
[12:09:19] <Zagdul> anybody experiencing the same thing?
[12:09:44] <Nodex> use a pastebin dude!
[12:09:55] <Zagdul> sry
[12:10:06] <Nodex> is one of your sets offline? or perhaps timing out?
[12:10:47] <Zagdul> http://pastebin.com/k09EJ4gK
[12:10:51] <Zagdul> no - all online
[12:10:54] <Zagdul> all working
[12:13:16] <Zagdul> this worked fine for about 3 months now
[12:13:36] <Zagdul> but yesterday it caused the application to go down with lots of timeouts
[12:14:30] <Zagdul> The application is a java application using Java-Driver 2.10.1
[12:15:00] <Zagdul> somehow it seems like the application nodes are connecting to the node that is just replicating and in state "STARTUP2"
[12:17:19] <Zagdul> the second bug did occur only with 2.4.2 - as it worked fine with 2.2.4 and 2.4.1
[12:17:41] <Zagdul> any ideas what could cause such a strange behavior?
[12:17:53] <alcuadradoatwork> in the aggregation fw, who does $group work when _id is an object? the doc says nothing about it
[12:20:09] <Zagdul> http://pastie.org/7697183
[12:21:20] <Nodex> alcuadradoatwork : I assume the same as anything that's an object - dot notation
[12:23:01] <Zagdul> is it possible that the timout bug is caused by having one node "hidden" and "priority=0"?
[12:23:09] <Zagdul> or right now just priority=0?
[12:27:23] <alcuadradoatwork> I see, but now I read that $group works in memory, so that won't work for me. thanks Nodex
[13:02:21] <woozly> guys, how to increase .update speed?
[13:02:35] <woozly> I have ~ 5-10 updates/sec
[13:02:38] <woozly> :/
[13:03:00] <woozly> Java Driver
[13:03:20] <woozly> messages.update(
[13:03:20] <woozly> new BasicDBObject("id", packet.getSequenceNum()),
[13:03:20] <woozly> new BasicDBObject("$set", new BasicDBObject("message_id", Long.valueOf(packet.getMessageId())))
[13:03:20] <woozly> );
[13:03:22] <Nodex> use php
[13:08:33] <Kosch> Creates "Oplog" a set of files similar of Oracles Redolog, which can be used as kind of incremental backup?
[13:11:01] <Zagdul> Kosch, I don't think so. Technically you're probably right, but I don't think there's a way to play back such a stored oplog
[13:11:39] <Zagdul> woozily - this is strange, we have a similar collection here, updating (from Java!) works about 1000/sec
[13:14:17] <Kosch> Zagdul: how is usually the backup problem solved when having large amount of data? always backup all data sounds not really practical to me.
[13:17:19] <Zagdul> Kosh: if you have an Idea, tell me ;-)
[13:17:39] <Zagdul> Kosh: we're exporting everything (right now about 250GB only - so that works for now)
[13:17:51] <Zagdul> and: we created incremental backups of the filesystem
[13:17:53] <Zagdul> THAT works
[13:17:58] <Kosch> Zagdul: I'm not B5 Kosh ;-)
[13:24:50] <Kosch> Zagdul: Unfortunality the situation is that the data is located on hardware sitting in customers office. so I've only usb or network as transfer medium... indeed, maybe FS snapshots using LVM could be an option.
[13:34:46] <Kosch> Zagdul: gnaa
[13:35:02] <Zagdul> ;-)
[13:35:27] <Zagdul> Kosch: but probably not as often - maybe once a month or so
[13:50:04] <Kosch> Zagdul: during export the database is locked, isn't it?
[13:52:21] <Zagdul> zagdul: no, it's not
[13:52:29] <Zagdul> Kosh: no, it's not
[13:52:42] <Kosch> Zagdul: or other idea: lets say I'd configure an 2nd mongod as secondary. when backup is started, the secondary node is started and data will be replicated. the secondary stores their data on the backup device. when finished, secondery mongod will be stopped. Is in these cases also everything replicated, or just the stuff between the last time secondary is started?
[13:53:26] <Kosch> np
[13:53:35] <Zagdul> kosch: this is actually valid scenario. The replication only replicates the things, that did change since last replication
[13:53:43] <Kosch> ah
[13:53:47] <Zagdul> kosch: this is when the oplog is used
[13:54:08] <Kosch> ok, then I'll follow this approach.
[13:54:12] <Zagdul> kosch: creating a node in a replica set as Hidden and with primary 0 is a backup node
[13:54:32] <Zagdul> this one never will be chosen as master, won't answer any calls
[13:54:37] <Kosch> ack
[13:55:01] <Zagdul> let me know, if you got any problems with that - we have a setup similar here (4 nodes Replicaset, 1 Hidden Backup node)...
[14:34:06] <Snebjorn> I'm trying to decide whether to embed a bunch of documents or keep them in a separate collection. How do you usually decide?
[14:35:55] <Zagdul> Snebjorn, depends
[14:36:10] <Zagdul> how big, what are your searches, do you need indexes....
[14:36:17] <Zagdul> there is no simple answer
[14:37:06] <Zagdul> as more people are here: anyone having problems with syncing a node in a replica set with 2.4.2?
[14:41:31] <saml> is replica set good?
[14:43:11] <Zagdul> saml: depends on your needs, usually, yes
[14:43:33] <sinclair-work> any C# people in here ?
[14:43:47] <sinclair-work> specifically ones who have used the C# Mongo Linq driver?
[14:44:36] <saml> WAT?
[14:44:39] <Nodex> you're probably better asking about c# in the mongo group
[14:45:32] <sinclair-work> Nodex: ?
[14:45:46] <sinclair-work> is this not the mongo group tho?
[14:45:49] <saml> sinclair-work, what's problem?
[14:46:13] <saml> any hot girl in here?
[14:46:20] <saml> specifically single ones?
[14:46:27] <sinclair-work> saml: oh, i was looking at the Linq stuff for the Mongo driver, and although i can query fine, it would be nice to use the Linq to filter a subset of documents to delete
[14:46:28] <saml> don't ask such questions
[14:46:40] <sinclair-work> i couldn't find much info on that tho
[14:46:59] <saml> ah i see
[14:47:09] <saml> i don't know what Linq is
[14:47:13] <sinclair-work> saml: in the C# driver, Linq queries return type MongoDB.Driver.Linq.MongoQueryable<T>
[14:47:32] <saml> if there's no info, probably it isn't implemented?
[14:47:37] <saml> let me google
[14:47:54] <saml> http://docs.mongodb.org/ecosystem/tutorial/use-linq-queries-with-csharp-driver/
[14:48:13] <sinclair-work> saml: yes, it doesnt explain removal
[14:48:20] <saml> you want to query a bunch, filter to reduce the result and remove ?
[14:48:48] <sinclair-work> basically, i need to turn a MongoDB.Driver.Linq.MongoQueryable<T> into a MongoDB.Driver.IMongoQuery
[14:48:59] <saml> https://groups.google.com/forum/?fromgroups=#!topic/mongodb-csharp/WfeXCZH5tQ4
[14:50:52] <sinclair-work> saml: hmm
[14:52:02] <saml> http://docs.mongodb.org/ecosystem/tutorial/getting-started-with-csharp-driver/#remove-an-existing-document
[14:52:45] <sinclair-work> saml: that isn't using LINQ tho
[14:52:59] <sinclair-work> saml: it might help to know what LINQ is first
[14:53:11] <sinclair-work> i think i may have found a solution tho..
[14:53:16] <sinclair-work> a strange one
[14:53:56] <sinclair-work> var query = (MongoQueryable<T>)collection.AsQueryable<T>();
[14:54:20] <sinclair-work> i need to cast the query, otherwise it returns IQueryable
[14:54:36] <sinclair-work> on the object MongoQueryable<T> there is a method GetMongoQuery
[14:54:58] <sinclair-work> IMongoQuery GetMongoQuery(); <-- signature
[14:55:06] <sinclair-work> i should be able to pass that to the remove method
[14:55:18] <sinclair-work> thanks for your help guys
[14:55:35] <saml> you're welcome. now buy a mongodb tshirt
[14:55:58] <sinclair-work> saml: that license do i need to agree to to wear it?
[14:56:03] <Snebjorn> Zagdul: The embedded documents are small in size but there are a lot of them. Lets say a document look like this { _id: ObjectId, owner: userRefId, ... } then I'd like to query on all owners. When I put them in a separate collection even if I index on owner I can only get about 30 queries/sec (benchRun) which I find odd. However if I embed them and do a find({"subs.owner:xyz"}) then I get about 30k quries/sec however I get a lot of
[14:57:30] <ninkotech> sinclair-work: would you prefer GPLv3 ? :)
[14:58:11] <ninkotech> sinclair-work: do you actually read licenses of all software you install?
[14:58:38] <sinclair-work> ninkotech: of course
[14:58:41] <sinclair-work> ninkotech: do you?
[14:58:47] <saml> so when i use replica set, all apps need to be changed to connect to replica set
[14:58:56] <ninkotech> sinclair-work: i do
[14:59:07] <ninkotech> i even read terms of usage on websites, lol
[14:59:23] <saml> why can't it be transparent?
[14:59:54] <saml> if app connects to mongo01.mongodb.com , it doesn't have to know if the end point is replica set or not
[14:59:55] <sinclair-work> well, if you are going to use some software in a commercial product, better be familiar with the license, otherwise....you'll get burned one day
[15:00:22] <ninkotech> yes... what dont you like on agpl?
[15:00:57] <scoates> I stumped Derick with this one yesterday. Maybe someone else might know why my query (second stanza) isn't using the "right" index (see the next stanza for the hint), here? http://paste.roguecoders.com/p/4face5649612e840da04c5fea0491c9b.txt
[15:01:33] <Zagdul> Snebjorn, this is weird. R U sure the index was hit? usually the separate collection should be faster
[15:02:00] <sinclair-work> ninkotech: just things, i don't really have much time to go into detail as i have a meeting to be in in 5 mins
[15:02:09] <ninkotech> sinclair-work: btw, thats why i dont use most mainstream webs
[15:02:10] <sinclair-work> ninkotech: let's discuss later
[15:02:14] <ninkotech> ok :)
[15:02:46] <Snebjorn> Zagdul: I used ensureIndex({owner:1})
[15:03:00] <meekohi> I'm such a n00b. How do I count the result after aggregate($group: {…})?
[15:03:36] <meekohi> .aggregate({ $group: {_id: "$identifier"}}).count() doesn't work how I'd expect.
[15:03:51] <Zagdul> Snebjorn, and your query looks like? when you only have owner in the query, all should be fine. if your query is more complicated, the index needs to be as well
[15:04:59] <Snebjorn> query looks like this: find({owner:xyz})
[15:05:08] <Snebjorn> really simple
[15:05:39] <Snebjorn> but there are duplicates of owner ids so that might be the cause
[15:06:27] <Zagdul> unfortunately i have to run - maybe later!
[15:06:35] <Snebjorn> oki
[15:06:39] <meekohi> .result.length?
[15:06:41] <Snebjorn> thanks anyway :)
[15:28:10] <saml> what is write concern?
[15:28:19] <saml> http://docs.mongodb.org/manual/core/write-concern/ makes 0 sense
[15:29:19] <scoates> this is linked from that page: http://docs.mongodb.org/manual/reference/glossary/#term-write-concern
[15:30:15] <saml> is it an event raised when write fails?
[15:35:03] <saml> okay i downloaded and installed replica set
[15:35:06] <saml> now i be web scalin
[15:42:36] <Snebjorn> Any mongo gurus that wanna have a look at this http://stackoverflow.com/questions/16150942/to-embed-or-not-embed
[16:00:10] <Snebjorn> How do I cover an entire query with index if I only query on one element? Example: find({a:1}).explain() says indexOnly is false even though ensureIndex({a:1}) is called on the collection
[16:01:19] <kali> Snebjorn: you can only return field that are in the index
[16:01:35] <kali> try find({a:1}, {a:1, _id: false})
[16:01:41] <kali> but it will not be very interesting
[16:04:21] <saml> "errmsg" : "db exception in producer: 1000 replSet source for syncing doesn't seem to be await capable -- is it an older version of mongodb?"
[16:05:52] <saml> is 2.2.2 really old?
[16:05:55] <saml> should i upgrade?
[16:06:17] <Nodex> yup
[16:08:41] <saml> writing to replica set is much much slower
[16:18:13] <Snebjorn> kali: indeed :)
[16:23:58] <Nodex> https://www.destroyallsoftware.com/talks/wat
[16:24:02] <Nodex> pretty funny ^
[16:42:10] <dgarstang1> For some reason, this isn't working... find({'fun': 'pkg.list_pkgs'}, {'jid': 1}).sort([('jid', -1)]).limit(1) .... if i remove the limit(), the sort is fine. However, if I put the limit(1) back, the document I get is not the most recent...
[16:42:47] <Nodex> err
[16:43:04] <Nodex> is the value "pkg.list_pkgs" ?
[16:43:20] <dgarstang1> Nodex: sorry? That's the search criteria
[16:44:22] <Nodex> right so perhaps define "isn't working
[16:44:41] <dgarstang1> Nodex: I did. "owever, if I put the limit(1) back, the document I get is not the most recent..."
[16:45:12] <Nodex> sort is an object not an array
[16:45:26] <dgarstang1> Nodex: oookay...
[16:46:35] <Nodex> just an fyi, if you're using ObjectId's as your _id you get a free sort by using _id:-1
[16:47:08] <dgarstang1> Nodex: Without the limit(), I get a list of documents in descening order. I see the most recent first. However, after adding limit(1), I don't see that most recent document as I would expect, but apparently an arbitrary one.
[16:47:27] <dgarstang1> need to sort by jid
[16:48:47] <Nodex> you said you wanted the most recent document
[16:49:16] <Nodex> is there an index on jid?
[16:50:23] <dgarstang1> Nodex: Yes. Most recent, sorted by jid. Index? Don't know... i'll check.. just as soon as I google how to check...
[16:51:01] <Nodex> db.foo.getIndexes()l
[16:51:03] <Nodex> db.foo.getIndexes();
[16:51:48] <dgarstang1> Nodex: looks like "key": { "_id": 1 },
[16:52:14] <Nodex> that's a no then :)
[16:52:24] <Nodex> how many documents are in the collection?
[16:52:28] <dgarstang1> Nodex: I concur. :)
[16:52:38] <Nodex> db.foo.count();
[16:53:10] <dgarstang1> Nodex: ~ 2,500... but normally it will be a lot less. Hang on... I need to go back and have a chat with some people. I don't like how the document is structured anyway.
[17:30:59] <jol> Just upgraded a replicaset to 2.4.2 running with "noauth=true" and pymongo now spits "OperationFailure: database error: not authorized".. Tried upgrading to pymongo 2.5 without luck. Any idea of what could be wrong?
[17:41:26] <Nodex> sounds broke to me
[17:43:35] <Kzim> hi, i have this issue on mongodb 2.0.6 : right object doesn't have full shard key and shard version not ok in Client::Context: client in sharded mode, but doesn't have version set for this collection
[17:43:40] <Kzim> any idea please ?
[17:44:46] <dgarstang1> Q... update() doesn't seem to replace existing documents... true?
[17:45:10] <dgarstang1> that was worded badly...
[17:46:51] <kurtis> Hey, we have a fairly large project which dumps all of our analytics into MongoDB. I'm working on a web-service which includes Users (and possibly billing Info in the future). I'm worried about write guarantees. Would it be recommended to take a hybrid approach and use a traditional RDBMs for the user management aspect?
[17:47:23] <hallas> Hmm, anyway I can improve the performance of an _id: { $in: […] } query, it's running incredibly slow..
[17:49:07] <dgarstang1> does mongo have a replace into equivalent?
[17:49:41] <dgarstang1> I'd like to do an update(query), and do an insert if the document isn't there
[17:49:51] <hallas> it's called upserting
[17:50:01] <dgarstang1> hallas: k
[17:50:18] <dgarstang1> coll.update(key, data, {upsert:true});.... cool
[17:52:11] <zagdul> hi
[17:53:29] <zagdul> I already asked that a couple of hours ago, maybe there are some new people around that might have experienced the same problem: when setting the W to the actual number of nodes, it ends up in a timeout in our productive environment, no matter what timeout is defined
[17:53:51] <zagdul> this error also occurred once when W=MAJORITY
[17:54:04] <zagdul> this is really annoying....
[17:55:22] <zagdul> one other bug we have is the initial sync of a member in a replica set of 4 nodes: it causes the other nodes to "delay" answers or something, that caused a downtime of our application and cost us a couple of users
[17:55:53] <zagdul> I don't want to change the DB, but people in our company are discussing the migration back to MySQL again!
[17:55:57] <saml> how do I connect to replaca set using mongo shell?
[17:57:22] <kurtis> saml, I'm not a mongo expert by any means but maybe this helps? http://docs.mongodb.org/manual/reference/commands/#touch
[17:58:18] <saml> no
[17:58:35] <scoates> saml: just `mongo --host hostname.of.primary` (and --port if it's non-standard)
[17:58:53] <scoates> you can also connect to secondaries, but you'll need `rs.slaveOk()`
[17:58:57] <saml> scoates, primary changes
[17:59:49] <scoates> the shell is meant to connect to a specific node, not to be a general-purpose driver
[18:00:34] <dgarstang1> I can use _id as key right?
[18:01:49] <dgarstang1> because..... this.... db.doc.update({'_id': 'hot.foo.com'}, {'fun': 'test.ping', 'jid': '20130422175559545439', 'result': 'True'}, {'upsert': 1}) keeps inserting a new document with a new _id, rather than inserting one where _id = 'host.foo.com'
[18:03:04] <scoates> dgarstang1: specify the _id in the second object, or use $set
[18:03:29] <scoates> db.doc.update({'_id': 'hot.foo.com'}, {{_id: 'hot.foo.com', 'fun': 'test.ping', 'jid': '20130422175559545439', 'result': 'True'}, {'upsert': 1})
[18:03:43] <scoates> erm. ignore the extra {
[18:04:01] <dgarstang1> scoates: gotta be in both? Weird...
[18:04:41] <scoates> dgarstang1: pretty sure. I never use update without $set.
[18:05:26] <dgarstang1> scoates: Works. Thanks
[18:13:10] <saml> https://gist.github.com/saml/a9d1dfd14d8d199f1795 why can't mongoimport connect to my mongo replica set?
[18:14:14] <saml> i can use mongo shell to connect
[18:14:21] <saml> mongo --host saml.zapto.org --port 27018 listings
[18:15:40] <scoates> saml: what's the name of your replicaset?
[18:16:32] <saml> scoates, rs0
[18:16:53] <scoates> saml: you specified the wrong name in the host string, then.
[18:17:01] <scoates> `mongoimport -h 'rs01/saml.zapto.org:27017,sam…` <-- rs01
[18:18:08] <saml> scoates, oops thanks
[18:18:24] <saml> it was weird because when I typed the command in the ssh-ed shell, it worked
[18:18:27] <saml> but cron failed :P
[18:20:52] <Kzim> hello i have a "right object doesn't have full shard key" when i update. is there a way to rebuild the chunk or something ?
[19:07:08] <saml> wow log gets all crazy when I kill mongod
[19:07:13] <saml> after setting up replicaset
[19:08:10] <jol> hallas, check out 3rd section of http://snmaynard.com/2012/10/17/things-i-wish-i-knew-about-mongodb-a-year-ago/, maybe related to your issue?
[19:08:26] <hallas> jol yep
[19:10:27] <saml> why is it keep polling?
[19:10:35] <saml> when secondary goes down....
[19:10:42] <saml> do i need to manually reconfigure replica set?
[19:11:02] <saml> why doesn't configuration automatically change?
[19:11:27] <saml> i want to kill mongod when traffic goes down.. and rejoin for web scale
[19:12:08] <scoates> saml: yes, you need to manage the replicaset yourself.
[19:12:33] <saml> that's painful
[19:13:34] <scoates> there are probably tools for it. We manage ours, ourselves, and I don't find it painful.
[19:13:48] <scoates> (I do wish it could do auto-discovery like ElasticSearch does, sometimes, though)
[19:13:59] <saml> exactly :P
[19:14:03] <saml> it could be more REST
[19:14:20] <saml> i guess that why they made elasticsearch
[19:14:40] <scoates> they're very different.
[19:14:42] <scoates> we use both
[19:15:12] <saml> scoates, why do you use elasticsearch?
[19:15:26] <scoates> for search
[19:15:48] <scoates> donenotdone.com and gimmebar.com are both MongoDB + ElasticSearch
[19:17:31] <saml> ouch... when i change replica set configuration, clients need to reconnect using different mongodb:// uri
[19:18:04] <saml> oh man................ so i can't really have stable endpoint for clients to connect if i'm using replica set
[19:18:16] <saml> unless i can designate one instance as PRIMARY always
[19:18:18] <saml> is there a way?
[19:18:38] <saml> I want mongo01 to be PRIMARY always. if it goes down, whole thing goes down
[19:18:52] <saml> that's the only way i can think of to provide stable endpoint for clients
[19:18:55] <scoates> that's not how it works
[19:19:06] <saml> or when mongodb replica set changes, i need to change clients
[19:19:10] <scoates> provide all nodes in the connection string
[19:19:26] <saml> "all nodes" change
[19:19:26] <scoates> the clients will ignore nodes that are not currently in the replicaset (after initial connection)
[19:20:13] <saml> when clients connect to mongodb://m1,m2,m3,m4 when only m1 and m2 are live, clients (casbah, scala) keeps polling m3 and m4
[19:20:21] <saml> log grows really quick
[19:21:29] <saml> why can't clients just connect to mongodb://m1
[19:21:37] <saml> if m1 goes down, fine everything is down
[19:21:58] <saml> m1 should work as a loadbalancer distributing reads and writes transparently to m2,m3,m4,m5, ...
[19:22:23] <scoates> because it's not fine for everything to go down in the problem case that relicasets were designed to solve
[19:22:51] <saml> if your endpoint, mongodb://m1, is down, you have a serious problem
[19:23:10] <scoates> any of my database nodes can go down without affecting clients. that's the point.
[19:23:24] <saml> same with loadbalancer
[19:23:33] <saml> any of databse under lb can go down
[19:23:44] <saml> lb just has to be up. if not, you get alerted
[19:24:12] <scoates> you might be able to coax mongos to do what you want, but I don't know. Sounds like you're trying to make MongoDB do something that it's not designed to do, to me.
[19:24:13] <saml> m1 isn't really database. it can be. but it's transparent. it can be proxy, lb, or whatever
[19:24:20] <saml> it can be cache..
[19:24:25] <saml> needs to be REST , really
[19:24:53] <saml> yah i just can't grok mongodb
[19:39:14] <hallas> I'm using $in with an array of a 110 object ids
[19:39:35] <hallas> the query takes around 800 ms against a 1400 document collection
[19:39:50] <hallas> im querying on _id, and it's using a b tree cursor, still very slow imo
[19:39:58] <hallas> any idea? why?
[19:43:45] <hallas> hmm probably a driver issue maybe
[20:18:14] <scoates> hallas: a large $in isn't going to perform well. you probably need to denormalize.
[20:18:53] <hallas> scoates yeah actually it was because I was using Mongoose.js, which adds alot of ORM magic, which takes up a lot time and probably memory too
[20:19:04] <hallas> I just disabled that, and it came out in 20 ms
[20:19:13] <scoates> heh. lame. I hate ORMs (-:
[20:19:16] <hallas> through the API, not just directly queried on the db
[20:19:35] <hallas> yeah well I was getting worried
[20:19:37] <scoates> (especially because the Mongo drivers provide great ORMs on their own)
[20:19:58] <hallas> Mongoose is primarily for validation in my case
[20:20:01] <hallas> which it does really well
[21:08:51] <JoeyJoeJo> I have a collection of parent documents and a separate collection of child documents. I need to know which children belong to which parents, and each child will only belong to one parent. My plan is to include the ObjectID from the parent as a field in each child. Is that a good idea?
[21:09:46] <JoeyJoeJo> I know that this is trying to replicate SQL joins, but I need mongo for its lack of schema
[21:10:15] <scoates> that will work, JoeyJoeJo. Depending on your actual needs, it might be best to just store everything in one collection.
[21:11:03] <JoeyJoeJo> Ok, thanks
[21:23:16] <JoeyJoeJo> Does anyone know if there is a drupal module for querying mongo?
[21:23:28] <JoeyJoeJo> I asked in #drupal but no one answered
[21:29:11] <jstallar1> JoeyJoeJo: I've never used it, but this exists: http://docs.mongodb.org/ecosystem/drivers/php-libraries/#drupal
[21:29:39] <JoeyJoeJo> thanks
[21:33:20] <bartzy> Hello
[21:33:38] <bartzy> What would be the best way to insert a document with a unique index, but if it exists - return the _id of the document ?
[21:33:53] <bartzy> just try to insert, catch error 11000 and then get the document ?:\
[21:34:16] <Zelest> isn't that what upsert do?
[21:34:23] <Zelest> or am I misunderstanding the question?
[21:37:24] <bartzy> upsert returns the _id of the existing document?
[21:38:26] <bartzy> Zelest: upsert will also update, I don't want to update, I just want the _id.
[21:41:17] <scoates> bartzy: findAndModify with upsert
[21:41:35] <bartzy> scoates: Can you give an example ?
[21:42:08] <scoates> oh, except you don't want to have to supply the document…
[21:46:20] <scoates> bartzy: if it doesn't need to be atomic, I'd do a find and then an insert if the find fails
[21:46:34] <bartzy> scoates: Or the opposite, just to be sure
[21:46:59] <bartzy> insert, and if failed with code 11000 (duplicate key), get the document with the unique indexed field.
[21:47:21] <scoates> oh, if you know the key, sure