[00:04:40] <phrearch> something like this, but i have to figure out how to wait async on all updates, or do all updates in one query(which i would prefer if possible)
[00:47:25] <__mark__> how do I issue a "slaveOk" command via runCommand or $cmd.findOne({})? I keep getting "no such cmd: slaveOk". The shell command is "rs.slaveOk()" but I'm a database-driver author, and I need to figure out how to do this via the wire spec.
[00:49:06] <__mark__> for example, db.$cmd.findOne({dropDatabase: 1}) is synonymous with db.dropDatabase()
[00:49:23] <__mark__> in the shell, but how do I do slaveOk?
[03:53:01] <chovy> does anyone know of a way to run data migrations on a db? Like add some default attributes to existing documents?
[04:03:31] <ranman> anyone here an AWS expert, with EBS? is it better to ask for a few tiny volumes or one larger one?
[04:03:42] <ranman> chovy: I typically use map reduce for that stuff
[04:03:50] <ranman> chovy: you can also do massive $updates
[04:05:43] <chovy> ranman: is there any tools/npm modules for this? All I could find was db versioning stuff. I'm also using Mongoose too.
[04:06:23] <ranman> chovy: you mean a stored migration? I typically write that in a script and throw it in a folder like /migrations, you could do all of this with mongoose
[04:07:48] <chovy> i don't know what a stored migration is
[06:11:31] <netQt> Hi all. I'm using nodejs to insert data int mongo(no external lib like mongoose). All my integers are being saved as double, how do I set type to int? Now I'm using mongo's Long, but it stores my numbers as NumberLong object.
[06:46:11] <ranman> netQt: "By default, the mongo shell treats all numbers as floating-point values. The mongo shell provides the NumberLong() wrapper to handle 64-bit integers."
[06:46:36] <ranman> NumberLong is probably what you want
[06:46:46] <ranman> unless you really care about space and are working with small integers
[06:46:53] <ranman> in which case I guess you could use NumberInt
[06:48:32] <ranman> spychalski: oid = db.test.findOne()._id; oid.getTimeStamp() ?
[06:49:09] <ranman> spychalski: I'm not sure I understand what you're asking
[06:49:54] <spychalski> i'll try again. my schema has a category with type ObjectId. category is another schema which has, say, a name. i want to be able to do 'mainschema.category.name'
[06:50:31] <spychalski> atm i need to do 2 queries.
[06:50:42] <netQt> I can use NumberLong from mongo shell, and it works perfectly, but I can't find that in the node's mongo lib. It has Long, but it doesn't store correctly.
[06:51:31] <spychalski> netQt: i THINK just long should do. i'm not sure though
[06:51:53] <netQt> mongo.Long(new Date().getTime()) this breakes the timestamp, it doesn't store correctly
[06:54:09] <spychalski> long should be able to store to 2147483647
[06:56:01] <netQt> that's why it cannot store my timestamp, I need to somehow specify NumberLong that works in mongos shell
[06:56:36] <spychalski> are you storing microseconds or something? sorry i wasn't here earlier
[06:56:52] <ranman> netQt: have you considered storing a timestamp instead?
[06:58:02] <ranman> spychalski: that's because mongodb is not a relational database, if you want to fetch two documents, you do two queries, there is a concept of a DBRef but I would avoid that
[06:58:30] <ranman> spychalski: have you considered embedding the information you do need in that document along with the objectid reference?
[06:58:39] <spychalski> ranman: should I instead set my type to the category schema itself then? i had issues with uniqueness doing that earlier
[06:59:33] <ranman> spychalski: you're being a little to data specific for me to give a recommendation sorry :(, could you throw it in a gist/pastebin and maybe explain what your end goal is as well? just don't want to give you bad advice
[07:15:30] <ichetandhembre> my monitoring agent is hosted on another ec2 instance than my server
[07:19:39] <spychalski> ranman: apparently my code was wrong and thats why it wasn't working. sorry =(
[07:20:00] <ranman> spychalski: it's ok, that's like... almost always the case when I write code :D
[07:20:33] <ranman> spychalski: I purchased a rubber duck that I explain all of my problems to, sometimes that helps, sometimes your coworkers just mutter about the crazy guy talking to the rubber duck
[07:20:35] <spychalski> I was using mongoose, creating a schema (category) and later referencing it as a type in a 2nd model. it should work
[07:20:56] <spychalski> really makes you wonder who's the crazy guy
[07:21:01] <joannac> ranman: should've stolen one of shaun's
[07:21:15] <ranman> joannac: I think I gave him that one...
[07:38:33] <ichetandhembre> in MMS which graph i should keep eye on to make sure every thing is working fine .. what these graph means ?
[07:42:23] <ichetandhembre> joannac: in MMS which graph i should keep eye on to make sure every thing is working fine .. what these graph means ? is there any doc about it ?
[07:43:57] <ranman> ichetandhembre: I typically watch for page faults and lock %
[07:45:16] <ranman> in clusters I typically watch memory usage, opcounters, lock %, queues, background flush average, and replication stats
[07:45:41] <ranman> repl lag is a good things to watch in clusters
[07:47:00] <ichetandhembre> ranman: thanks i would like to know more about these graph .. is there any doc explaining which and why graph is important ? srry for such naive question i am newbie in mongodb management stuff
[07:48:12] <ranman> ichetandhembre: this video might help http://www.mongodb.com/presentations/performance-tuning-and-monitoring-using-mms
[07:48:40] <ranman> ichetandhembre: mongolab has a good article: http://blog.mongolab.com/2013/12/tuning-mongodb-performance-with-mms/
[08:19:58] <spychalski> yes but since items references categories, it becomes unique too, for some reason.
[08:20:06] <Zelest> Derick, oh, also, do you have any words on the "no candidate server" issue I had? like, it stays like that until I restart php-fpm..
[08:20:08] <spychalski> maybe it's a mongoose problem.
[08:20:16] <Zelest> Derick, any way to "reset" php-fpm from php, without restarting it?
[08:21:43] <Derick> Zelest: reset how? kill all connections?
[08:33:44] <Zelest> silly question, I created a function in the mongoshell.. can I use this function everywhere now? as in, are functions like "stored proceedures" or are they just local inside my shell?
[08:42:48] <Derick> Zelest: just local inside your shell
[08:43:33] <Zelest> Derick, how can I use that function you linked from php? (getNextSequence) ?
[08:43:48] <Zelest> or should/can I translate that one to php?
[09:38:18] <Azitrex> is true , i find this and worked as fine , but today we have a new NoSql DB (Perst) with JSQL !! http://www.garret.ru/jsql/readme.htm i dont know how can i to limited result set !
[09:39:14] <rspijker> how is this an appropriate question for #mongodb?
[09:39:23] <jdj_dk> Azitrex well don't they have a channel for support =)
[09:39:44] <jdj_dk> not that we're not interested in helping.. But the change of us knowing the answer is very small
[14:16:48] <[EddyF]_> is anyone looking for work in London,UK? http://careers.stackoverflow.com/jobs/50317/php-developer-rocabee?a=ZmJB2vAI&searchTerm=PHP
[14:51:18] <rspijker> hmmm, so apparently it’s the sort that it can’t do with the index for some reason. Which brings the limit out of the sort as well and you’re sorting 17million records instead of 100
[15:07:11] <rspijker> “The sort document can be a subset of a compound index that does not start from the beginning of the index. For instance, { c: 1 } is a subset of the index { a: 1, b: 1, c: 1, d: 1 } that omits the preceding index fields a and b. MongoDB can use the index efficiently if the query document includes all the preceding fields of the index, in this case a and b, in equality conditions.”
[15:40:59] <fewt> can’t find any docs that say yes or no
[15:41:02] <dgarstang> Anyone awake? I'm trying to deploy 2.6. The docs say in 2.6 the config switched to yaml but it's backwards compatible. This seems to be untrue. Mongo complains if the config file is not in yaml format.
[15:45:21] <dgarstang> rspijker: Correct. If I deploy 2.6 with non yaml config file format, it complains. For example it complains about the 'nojournal' entry and then a few others
[15:49:40] <rspijker> dgarstang: I don’t know about all the options. The general format still works though. I’m not having any issues with a test deployment. Mind you, I’m not using the nojournal option.
[15:50:06] <rspijker> but if some of the options aren’t working, that does mean it’s not entirely backwards compatible
[16:08:28] <dgarstang> rspijker: smallfiles also causes an error
[16:08:41] <rspijker> dgarstang: that works fine for me...
[17:09:50] <dgarstang> And googling "Error parsing INI config file: unknown option nojournal" gets me nothing AT ALL
[17:17:18] <dgarstang> Something is very screwed up with mongos. I modified /etc/mongodb.conf to the yaml file format and now I'm getting "Unrecognized option: storage.journal.enabled".
[17:22:01] <kongthap> hi, i'm trying to setup authentication, i can use db.auth(), i can display admin.system.users content, but why i cannot use "show collections" it returns error (more: http://pastie.org/9190172), windows 7, mongodb 2.6.1
[17:34:53] <dwstevens> if i want to update some statistics fields on a document after save, can I do so with a post save hook? Specifically I want to summarize one of the arrays in the model
[17:35:15] <dwstevens> would saving a doc again cause the post save hook to be recursively called?
[18:21:57] <kongthap> i'm trying to setup authentication, i can use db.auth(), i can display admin.system.users content, but why i cannot use "show collections" it returns error (more: http://pastie.org/9190172), windows 7, mongodb 2.6.1
[19:56:37] <xofer_> hello, i am trying to add a 2.4.10 node to a replicaset with 2 x 2.4.9 nodes, and it's unable to sync (falls further and further behind) -- i've pretty much ruled out hardware and network -- any ideas?
[20:03:52] <xofer_> the other odd thing about the 2.4.10 is that its cpu usage is low, around 100% on a 16-core machine
[20:12:59] <federated_life> also, something about 2.2+ is that it only clones from the primary…in 1.8, you could have it pull the initial sync from secondaries
[20:13:19] <xofer_> (there is some mystery as to wheter we're getting "advanced networking" in aws)
[20:13:20] <federated_life> xofer_: check charts for correlation
[20:13:25] <jiffe98> I have a replica set with 3 nodes and I need to take one of them offline but when I do that, the 3rd node which is primary turns into a secondary and there's no primary nodes
[20:13:31] <jiffe98> any way to keep that one running?
[20:13:44] <federated_life> jiffe98: pastebin your rs.conf()
[20:14:13] <xofer_> federated_life: the thing is the only difference here is the new version
[20:14:24] <xofer_> we have added nodes without any problem quite recently
[20:14:29] <MacWinner> is it possible to just called .update() on results from .find() eg… db.testdb.find().update(…)
[20:15:15] <federated_life> xofer_: its unlikely that such a minor revision did anything unless you see an error in rs.status or the logs. you can increase verbosity of the logs .. db.adminCommand({ set : paramter : 1 , logLevel : 3 })
[20:20:33] <jiffe98> reading back I didn't say that, I'm sorry, I meant I needed to take two of them offline, one was already offline so I needed to take one more offline
[20:20:47] <dgarstang> omg, this is so confusing. What config files do mongod and mongos use? mongodb.conf? mongod.conf? WHich one uses which!!?!?
[20:21:40] <jiffe98> the reason I need to take two of them offline is because one of them is corrupt so I need to sync the other secondary to it
[20:22:03] <federated_life> xofer_: change your syncdelay to 5 seconds
[20:22:20] <xofer_> federated_life: even though "Do not set this value on production systems"
[20:25:47] <federated_life> jiffe98: you need to fix your replica set…you can also rs.reconfig( {},{force:true})
[20:26:04] <federated_life> emgram: do an explain on your query
[20:26:04] <dgarstang> xofer_: I'm installing this with a chef cookbook which is having issues, so I'd rather not reply on what's deployed. it might be wrong. it's written for 2.4 and stuff changed in 2.6
[20:26:12] <federated_life> and pastebin the results
[20:26:41] <dgarstang> now, if there was just some docs, that you know, said what config file what processes used, that would be a helpful starting point
[20:26:43] <xofer_> dgarstang: well on my systems (ubuntu) the config path is specified in the command
[20:27:19] <xofer_> is there something like /etc/defaults/mongodb ?
[20:27:25] <dgarstang> federated_life: really? because certain options like smallfiles, nojournal mongos complains about
[20:27:27] <federated_life> dgarstang: you set the config file location when you startup mongod
[20:27:41] <federated_life> dgarstang: those are parameters that you put in your config file
[20:27:43] <xofer_> by *you* he means whatever started it
[20:27:54] <dgarstang> federated_life: i've seen referneces to mongodb.conf, mongod.conf at least
[20:28:04] <federated_life> you can call the file whatever.conf
[20:28:09] <federated_life> doesnt matter what its called
[20:28:15] <federated_life> you set the path when mongod starts
[20:28:18] <dgarstang> federated_life: what about the options that mongos complains about?
[20:28:39] <federated_life> dgarstang: if you put wrong options then thats your fault…
[20:28:53] <emgram> federated_life: I have a set of chats with topics and want to only ever have the 20 newest topics stored. thus if there are 21 topics I want to find the least used topic and delete every chat with that topic.
[20:28:53] <dgarstang> federated_life: if there's options that mongos doesn't like, seems to make sense there'd be more than one config file
[20:28:54] <federated_life> but they all go in the one config file…unless you add them to the startup string
[20:29:02] <xofer_> federated_life: i have a lot of "repl writer worker 1" messages in the log
[20:29:03] <federated_life> dgarstang: there is not more than ONE
[20:34:41] <federated_life> xofer_: yea, so with that extra verbosity, you see stuff … like, you can see the journal files getting created and removed, etc etc the repl write workers are, I think, the batch replication applies
[20:34:54] <federated_life> you can always google it or read the comments in the code :)
[20:41:40] <federated_life> dgarstang: Id recommend, from experience, not to disable the journal, but instead, to put it on a second raid volume [ ie ssd's ] …since Im guessing you want to reduce IO
[20:41:50] <federated_life> dgarstang: here's the funny part though…smallFiles are for journaling
[20:42:00] <federated_life> so…if you disable journaling, the small files option is bogus anyhow
[20:44:21] <dgarstang> federated_life: How about now? http://pastebin.com/gkSJKacg has 'nojournal = false' but it doesn't like that
[20:45:05] <federated_life> dgarstang: dude , its realyl simple
[20:45:09] <federated_life> you must be messing with me
[20:45:17] <federated_life> I wrote 'true' and you put 'false'
[20:45:34] <dgarstang> federated_life: why would true or false make it report nojournal is invalid?
[20:45:57] <dgarstang> federated_life: you also suggested later I don't disable journing, hence nojournal = false
[20:46:07] <federated_life> dgarstang: Ive only ever sued 'true' values, never false
[20:46:18] <federated_life> journaling is enabled by default in 2.0+
[20:46:40] <dgarstang> this would also suggest https://github.com/edelight/chef-mongodb/issues/289 that mongos doesn't like nojournal'
[20:47:04] <federated_life> mongoS does not have a jounral
[20:47:25] <federated_life> conceptually, mongoS only routs traffic…you would only need a journal if your worried about data consistency…not in the case of routing
[20:47:28] <dgarstang> federated_life: that's sorta what I've been asking...
[20:47:39] <dgarstang> so if there's one config file... how will mongos work?
[20:48:02] <federated_life> dgarstang: before , you were writing 'mongo' without the 'S"
[20:48:16] <dgarstang> pretty sure I mentioned mongos several times
[20:48:26] <federated_life> dgarstang: got stuff to do bro, sorry
[20:48:36] <dgarstang> federated_life: too hard basket?
[20:49:03] <dgarstang> i thought it was simple. :(
[20:49:12] <federated_life> try using tokumx 1.0 rc0 in a sharded cluster and then ask me
[20:49:32] <dgarstang> federated_life: i'd rather start with the simple stuff
[20:50:13] <federated_life> dgarstang: you need to learn whats the different processes…mongoD vs mongoS
[20:50:21] <federated_life> and basic architecture of a cluster
[20:50:42] <federated_life> dgarstang: probably, you should just use mongoctl ..its python scripts from mongoLabs…super easy and fast for mongo
[20:51:22] <emgram> how do I get the result of an aggregate sorted?
[20:51:27] <emgram> here's my attempt http://pastebin.com/jw6KFh2V
[20:52:07] <emgram> I'd like to delete everything not within the top 10 "latest" numbers
[20:52:11] <dgarstang> oh come on. now mongod is reporting "Error parsing INI config file: unknown option configdb" when starting... pointing to that ONE config file that they allegedly all use
[20:54:37] <federated_life> dgarstang: probably you;ll benefit form going to an office hours / meetup
[20:55:44] <dgarstang> federated_life: just basing it on this cookbook, which seems to start mongod and mongos on the router.
[20:56:00] <dgarstang> lots of people have used/forked it, so it's gotta be pretty close you'd think
[20:58:14] <dgarstang> certainly seems to want to connect to something local "WARN: Could not connect to database: 'localhost:27017', reason Failed to connect to a master node at localhost:27017"
[21:25:14] <abonilla> Hi, where is the documentation for mongodb.conf so that I can start a DB and its set already for replication?
[21:27:09] <emgram> how do I use these results to delete all chats that match any of these _ids? http://pastebin.com/LShsjN5J
[21:28:09] <emgram> it is an aggregate result that returns a list of topics that are candidate for deletion
[21:31:11] <dgarstang> Confused. I have 3 config servers and a running mongos. how do I connect to mongos since mongod isnt running on that box?
[21:40:48] <dgarstang> ah more errors "mongos specified a different config database string"
[22:09:22] <yutong> anyone have a recommended guide on how to manually have mongo start on bootup?
[22:14:40] <dgarstang> Weeee. What does "could not verify config servers were active and reachable before write" mean?
[22:19:06] <jimpop> any idea on why FTS for "red white -blue" would take 3 times longer than for "red white"? It seems that negating a few results should be fairly easy.
[22:30:23] <dgarstang> man this stuff just ain't working for me
[22:30:37] <palominoz> hello there. any good ideas on how to convert an HTTP GET to a mongoose/mongo query with javascript? sorting, population, and quite advanced queries are required
[22:31:09] <dgarstang> mongos says it starts fine but then trying to connect gets me "ould not verify config servers w...""
[22:31:11] <ranman> palominoz: can you have them write the query themselves?
[22:32:17] <yutong> clusterAuthMode keyFile Use a keyfile for authentication. Accept only keyfiles.
[22:32:17] <palominoz> @ranman in some way yes. but the main use cases i would like to support are like products?manufacturer=some-mango-id&sort=-price
[22:32:58] <ranman> yutong: you might not need that if it's not a production system
[22:33:44] <palominoz> @ranman for those not trivial searches it may be a good idea to support things like products?query={ some: { mongodb: 'thing' }}
[22:33:58] <yutong> ranman, it is a production system
[22:34:10] <yutong> i dont' understand how the security model for replicas work
[22:34:21] <palominoz> @ranman but at the moment i have no idea about escaping and securing things on mongodb
[22:34:58] <ranman> palominoz: only thing you have to watch out for is $where, rest of the stuff is a non-issue
[22:35:50] <palominoz> ranman: is there any good node library you know that could help this sort of things?
[22:35:50] <ranman> palominoz: if you have the parameters I think it's pretty easy to create a method that will generate a query
[22:38:40] <ranman> palominoz: and is therefore dangerous
[22:38:58] <ranman> palominoz: but that's seriously the only escaping concern, very different from SQL injection
[22:40:59] <palominoz> ranman: what about use cases that would make use of $where?
[22:41:30] <ranman> palominoz: don't allow them, too dangerous, who wants to execute arbitrary javascript anyway? if someone wants to do that a DBA or some such person should approve it.
[22:41:49] <ranman> palominoz: literally worked with 1000s of applications, infrequently does someone need where
[22:41:51] <dgarstang> What might this mean? "create ns_1_min_1 index on config db: could not verify config servers were active and reachable before write"
[22:42:14] <ranman> dgarstang: sharded cluster ... it seems like your config servers aren't reachable?
[22:43:04] <dgarstang> ranman: they are and the logs indicate they are. I just noticed that it logs "config servers and shards contacted successfully" AFTER above error
[22:43:44] <palominoz> ranman: oke. nice advice. thank you for the support man.
[22:43:48] <ranman> dgarstang: mongodb, version, #config servers, which log is outputting that
[22:44:15] <dgarstang> ranman: version 2.6.1, thats logged to /var/log/mongodb/mongodb.log on mongos node
[22:44:55] <dgarstang> it's logging the error at 076 and the connection is at 102... jeez... 76 (milliseconds) to contact all config server isn't fast enough!?
[22:45:49] <ranman> dgarstang: is the cluster behaving as it should?
[22:47:33] <dgarstang> ranman: here's the log... http://pastebin.com/RBF7gFFM this is a new install... so i've only gotten as far as the config servers and the routing server so far
[22:51:18] <dgarstang> Ugh. Searches for the error "could not verify config servers were active and reachable before write" are getting me C++ code. That's never a good sign
[22:51:32] <ranman> yeah I've never seen this before
[22:55:14] <dgarstang> This is in Amazon too, but I doubt that's an issue. 76 milliseconds is pretty fast to give up
[23:05:12] <federated_life> dgarstang: you need to add a shard before you can write any data to the clsuter
[23:05:25] <federated_life> sounds like you have your config servers and shard routers…but no where to put the data
[23:06:10] <dgarstang> federated_life: is that definitely required? was hoping, thinking, based on what I read, that I could set up the config servers first, mongos, verify that's working and then move on
[23:06:27] <dgarstang> if that's true, man those errors are misleading
[23:07:06] <federated_life> don't you understand binary? ;)
[23:09:49] <dgarstang> I'm following the oreilly book here. it walks through the sharding setup. If they haven't configured sharding yet, what's their mongo shell connecting to? one of the config servers?
[23:10:07] <federated_life> dgarstang: conceptually, you have your config servers that hold meta data, then you have your routers [ mongoS ] that router requests adn keep the config data in memory…then you have your mongoD's that are replica sets and comprise a shard. so, each replcia set is a shard
[23:10:23] <dgarstang> federated_life: i got that far.
[23:10:32] <federated_life> dgarstang: perhaps you did not specify the config server URI when starting the mongoS?
[23:12:19] <federated_life> when you start up your mongoS process, you need to specify the config servers , configdb=host1:27019,host2:27019,host3:27019
[23:12:23] <dgarstang> sorry for the bad venacular. i used 'mongo'
[23:15:43] <federated_life> take your time, Ill send the bill later ;)
[23:15:53] <dgarstang> not seeing any specific instructions on sharding at http://docs.mongodb.org/manual/core/sharding-introduction/
[23:18:06] <dgarstang> http://pastebin.com/9trKR7g4 ... so if the reason it's reporting "could not verify config servers were active and reachable before write" BEFORE it even tries to connect to the config servers is due to sharding not being configured, then ok.
[23:19:51] <dgarstang> The guide at http://docs.mongodb.org/manual/tutorial/deploy-shard-cluster/ CLEARLY says to set up the config servers first followed by mongos. Nothing about setting up sharding yet.
[23:23:09] <dgarstang> The guide at http://docs.mongodb.org/manual/tutorial/deploy-shard-cluster/ CLEARLY says to set up the config servers first followed by mongos. In their example, once the config servers have been set up, you should be able to use 'mongo' to connect to the local 'mongos'.
[23:35:21] <federated_life> dgarstang: yea..make sure your bindip is set
[23:35:38] <federated_life> or try connecting on the IP address that the process is listening on
[23:37:51] <dgarstang> Don't think thats necessary. Starting mongos process returns "Starting mongos: warning: bind_ip of 0.0.0.0 is unnecessary; listens on all ips by default"
[23:38:45] <dgarstang> Same deal tho. http://pastebin.com/Cd9RufWn
[23:39:16] <federated_life> dgarstang: it says your config servers are mesed up
[23:39:24] <dgarstang> ^ it's connecting. There's obviously a process listening.
[23:39:41] <dgarstang> federated_life: it seems to be logging that they are ok
[23:39:44] <federated_life> dgarstang: your mongoS is running…but your config servers are messed up
[23:39:56] <federated_life> pastebin your mongoS log
[23:47:08] <federated_life> dgarstang: run this , netstat -an | grep '\*'
[23:47:12] <federated_life> and pastebin the result
[23:48:37] <dgarstang> wtf? I stopped and restarted all three config servers, which I had done at least ocne already, and restaretd mongos router and now I can connect with mongo. Ugh!