[00:20:59] <joannac> grandy: as linked to here http://mongoosejs.com/ under "support"
[01:14:23] <ThePrimeMedian> i have a large dataset, and I need to regex search on the name field. However, I need to sort on the status, and then name field. If I do not sort, the query is really quick. But if I put the sort in, it take > 1m -- any help would be appreciated.
[01:22:07] <joshua> You might want to have the sort fields indexed
[01:22:45] <joshua> Maybe even a compound index based on the whole query if you do it that often.
[01:29:51] <ThePrimeMedian> joshua: i have the sort fields indexed.
[01:30:27] <joshua> did you run the query with .explain() to get some more info as to whats going on?
[01:32:38] <joshua> It has been a while since I did that kind of thing so might not be able to explain (har har) what all the results mean, but I think its a good idea in general to see what is going on.
[01:35:52] <ThePrimeMedian> the first cursor of the explain says it used the "sort" index -- to be honest, i dont know how to read it.
[01:44:00] <acidjazz> is there a simple way in mongo to search an object in a documents keys?
[01:58:01] <joannac> next time, it would be appreciated if you formulated an actual example
[03:27:59] <louie_louiie> has anyone used R with MongoDB?
[06:18:33] <sigfoo> Excuse me if this is a little off-topic. I have a question about working with Mongo with the node.js native driver
[06:18:36] <sigfoo> 02:12 < sigfoo> Hello all. I'm working on a web app in node and I'm a little new to the paradigm. My app has a MongoDB backend and I'm working with the native Mongo node driver. Should I be instantiating a single connection to the DB and serving all requests from that connection? Or should I be calling MongoClient.connect once for every HTTP request?
[06:40:01] <Boomtime> you should call .connect only once and use that object for everything
[06:40:38] <Boomtime> note that if you use the nodejs clustering module, you will end up with lots of these anyway because the cluster module instantiates multiple copies of the runtime on your behalf
[06:41:52] <sigfoo> Guess I have to do a little refactoring
[06:42:11] <mskalick> Hello everybody, is there any option how to run rs.remove() on the server-site before the server is terminated? Thank you very much, Marek
[06:46:35] <Boomtime> it sounds like you need a stop script (not mongodb), but perhaps if you explain why you need this we'll understand and be able to consider alternatives
[06:49:09] <mskalick> jonnac Boomtime: I want to have working replication in Docker container - in this container is only one process (mongod). So have running for example 5 containers~mongod. And I would like to know if it is possible to remove one mongod server when the container is going to be killed. Without any other control script (which must run in new separate container)
[06:50:08] <mskalick> So it would be nice to be able to run rs.remove() when the mongod is going to be killed...
[06:56:10] <Boomtime> mskalick: i don't think you understand the point of replica-sets
[06:56:46] <Boomtime> if a node needed to pre-announce it's own failure then that isn't a very redundant system
[06:57:46] <mskalick> Boomtime: why?... not the failture! It is the part of scaling ~ to be able to "automatically" add or remove shards...
[06:57:48] <Boomtime> if you have a correctly configured replica-set, you can happily lose a member through any cause, and the rest will plow on without that one
[06:58:30] <Boomtime> rs.remove = replica-set member control, nothing to do with sharding
[06:59:12] <mskalick> Boomtime: sry, not "shards". I thought members of replica-set...
[07:00:22] <Boomtime> ok, you also used the word "scaling".. replica-sets are intended to provide high-availability, sharding is the preferred method to scale up
[07:00:45] <Boomtime> regardless, the need for any given member to pre-announce it's own demise is fundamentally the wrong way around
[07:02:18] <Boomtime> what is controlling the addition of new members?
[07:02:26] <mskalick> Boomtime: "you can happily lose a member through any cause" -> And it is not problem when the loose is intended? (I know that the mongod will never come online again) ~ so after some time of running there could be a lot of never active members...
[07:02:51] <Boomtime> fine, you remove those members via the remaining members
[07:04:06] <Boomtime> in any case, you clearly have some control system that is creating/destroying these members - why can't that process perform the maintenance?
[07:04:27] <mskalick> Boomtime: Adding is no the problem, bacause in the container you run mongod in the background, connect with mongo shell + add to the replica-set. Then mongod is stoped and there is "exec mongod" (to properly receive signals,...). So with execed mongod it not possible to run rs.remove()
[07:05:25] <joannac> okay, so in the container, connect with mongo shell and run "rs.remove()
[07:05:25] <Boomtime> : "bacause in the container you run mongod in the background" <- what is doing this?
[07:05:38] <mskalick> remaining members also have only one process mongod. Without any shell,...
[07:06:10] <mskalick> in the linux shell you run "mongod <config options> &"
[07:06:17] <joannac> mskalick: what do you mean, without any shell?
[07:07:08] <mskalick> joannac: sry, without any linux shell,... There is only one process (mongod)
[07:09:12] <Boomtime> mskalick: mongodb is a database, not a linux process control system - if you need to do tasks related to the starting and stopping of containers, you need a process control system
[07:11:59] <mskalick> Boomtime: I know. I only wanted to know if there could be some hooks to run on system terminating...
[07:12:40] <joannac> If you want to write a script that will run on system termination, sure
[07:19:21] <joannac> is it completely inapprorpiate for the mongod server to do that
[07:20:12] <joannac> if you are so certain that you are shutting down a server and never bringing it back up, you can engineer your own way to call rs.remove()
[07:20:17] <mskalick> yes. Thought to be able to register function which will be executed on the mongod shutdown. And in this function connect to the master and remove the mongod
[07:20:36] <joannac> the server cannot tell the difference between "I'm shutting down for some maintenance" and "I'm shutting down and never coming back"
[07:22:15] <mskalick> and without trying to distinguish these two things it is possible?
[11:09:07] <_MMM_> I have a collection of documents with a "data" field and I want a query result to only return the contents of the documents' data fields. Is that possible?
[11:09:48] <_MMM_> I tried the fields parameter of find() but that include the "data" fieldname itself for every document
[11:12:04] <dddh> _MMM: var c = db.table.find( { } ).sort( { data : 1 } ); c.forEach( function( doc ) { print( doc.data ) } );
[11:12:57] <bartzy> I have a collection of posts by users. The user id field is called uid. I want to get a list of all the post count per user, like this: Count of all users that posted 1 time or more, 2 times or more, 3 times or more.. etc …
[11:13:55] <bartzy> This gives me only exact counts - meaning the _id would be the number of posts, and the count field would be the number of users that posted this number of posts. But I don’t want exact equality, I want to get greater or equal.
[11:14:11] <bartzy> I looked at the docs, didn’t get how can I do that
[11:14:45] <_MMM_> dddh: well, yes but I was wondering if mongodb doesnt have some option to retrieve only the contents of subdocuments in the first place since that would probably be more elegant and better performing
[11:28:48] <joannac> why are you using findandmodify?
[11:33:35] <_MMM_> bartzy: wouldn't it be more efficient to do the >= grouping after retrieving the query since many documents would end up in a lot of groups of the posters usually have more than 1-2 posts only?
[11:33:59] <bartzy> _MMM_: But how can I achieve this… if we ignore efficiency
[11:36:55] <_MMM_> not sure how to do it exactly but I bet you need to make use of the pipelining here
[11:46:12] <aps> Hi all. Is it true that if my data and journal files are on the same volume, I don't need to fsyncLock( ) the secondary for take snapshot backup on Amazon EBS?
[13:07:54] <deathanchor> how do I filter for a sub doc? { some : [ { want : "this", dont : "want" } ] } so that I only see the want field of the first array subdoc?
[13:08:59] <StephenLynx> I think it might work, though
[13:10:25] <deathanchor> it does work without the [0]
[13:10:36] <sterichards> I’m trying to add a field ‘code’ with the value of ‘NA’ where ‘code’ doesn’t exist. I’m using the following, but it just returns 3 dots (…) via CLI - db.object.category.update({"code" : { "$exists" : false }, {$set: {"code":"NA"}}, false, true)
[13:13:18] <StephenLynx> yeah, if it "returns" ... its because the command is incomplete.
[13:20:12] <jhertz> Hi, I am really new to MongoDB and working in a project were it is suggested that we use it as a (query) cache for an oracle database. Is this a good use of MongoDB, does someone have a link to an article about this approach?
[13:21:08] <StephenLynx> I wouldn't do that, personally.
[13:21:36] <StephenLynx> if you just want a cache on top of the main database, there are tools meant specifically to be used as a cache, such as
[13:22:27] <StephenLynx> word of advice with redis: I heard its performance degrades drastically when your dataset is larger than your RAM
[13:23:06] <jhertz> I will read up on redis, seems worth while
[13:24:31] <StephenLynx> yeah, I heard it makes an excellent cache, much more than mongo.
[13:25:12] <jhertz> to me it sounds like we are trying to use the wrong tool for getting the job done, my hunch, which might be completely wrong is that MongoDB is not at all designed for this task, and therefore it probably does not makes sense to use it to solve this problem.
[13:26:26] <StephenLynx> mongo is not bad as a cache, is just not the best thing for it out there.
[13:30:12] <jhertz> then I think you can argue that even if it is not the best thing, it might be good enough and since there is knowledge on how to use it inside the team, it makes sense to do so. Anyway thanks for the incite, it helps me understanding this a bit better and now I just have to do my homework :)
[13:35:06] <StephenLynx> see if you can replace oracle entirely by mongo.
[13:35:20] <StephenLynx> if you don't really depend on the relational capabilities of it.
[13:35:40] <StephenLynx> that would solve the issue in a more elegant manner.
[13:40:12] <deathanchor> StephenLynx: yep did that in house here. RDB was so slow for some operations we started cloning the data over to mongodb for speedy lookups
[13:47:10] <kaseano> hi, I was wondering if it was possible to update all the documents using a different value/column from each document
[13:47:19] <kaseano> ex like a lowercase version of "name"
[13:47:41] <kaseano> perfect thanks StephenLynx I'll look that up!
[13:50:52] <kaseano> StephenLynx: even with bulk write it looks like you have to use the same/static value for every document, instead of using the values on the document being updated
[14:18:29] <frankydp> Can anyone point me in the right direction to fix an index that needs to be unique, but that is not? Or is find update my best bet?
[20:28:24] <StephenLynx> I just use the official documentation
[20:28:39] <StephenLynx> and random bits of information I see
[20:30:41] <atomicb0mb> it worked just fine ! Thank you. :)
[21:31:03] <Astral303> hi, does anyone have any insight as to how stable or safe 3.0.6-rc0 is vs 3.0.5?
[21:31:13] <blizzow> We're inserting ~100mil records a day via 3 servers connecting to 3 mongos instances in front of a sharded cluster with 3 replica sets. Our mongos instances are melting their own faces off. Assuming an average 100kb document size with usually 20 fields, does anyone have recommendations on the number of connections and batch size for the inserts into our routers??
[21:59:42] <ehershey> but wait a day or two if you can
[21:59:49] <Astral303> I'm typically hesitant to go with rc0 releases, as sometimes there are banal regressions in WT that don't get caught until rc0 has been around in a few hands
[22:07:02] <Astral303> blizzow, what does "melting their own faces off" mean for mongos instances? are you maxing out CPU or network?
[22:07:26] <blizzow> joannac: I'm currently deploying some mongos processes on a few servers to try and reduce the load but the mongos only started face-melting after upgrading to 3.0.x. Astral303: Load and CPU.
[22:09:51] <Astral303> blizzow, if you are pegging CPU after upgrading to 3.0 on an otherwise identical setup with 2.6 (load-wise and cluster-topology-wise), then you're likely hitting an issue of some kind or a performance regression. i would imagine the storage backend would have no difference on mongos performance. it might be worth doing some stack traces or whatever the techniques are for starting performance diagnostics
[22:10:53] <Astral303> it's also possible that if you changed your storage engine to WT, then you might have considerably faster insert rates that are stressing mongos simply due to increased throughput
[22:11:10] <Astral303> so i guess, how many variables changed with the 3.0 upgrade?
[22:28:05] <blizzow> Astral303: We didn't move to WT. I'm wondering if the older java and spark drivers we use to communicate to mongo are bashing our mongos instances.
[22:53:17] <Astral303> blizzow, did you notice any decrease in your insertion throughput or latency? are the mongos processes pegged or the java drivers talking to mongo?
[23:31:48] <EllisTAA> hello. im trying to insert a record into my mongodb, but when i added this line: https://github.com/ellismarte/ellis.io/blob/master/server.js#L71-L75, i got this error message: https://gist.github.com/ellismarte/5a1be11878d3db879a39. it says db is not defined but according to this documentation that’s how you write it: http://docs.mongodb.org/manual/tutorial/insert-documents/
[23:41:21] <Boomtime> EllisTAA: the link you quote from is for the mongo shell, but you are clearly using nodejs
[23:41:32] <EllisTAA> boomtime: yes i am using node
[23:41:49] <EllisTAA> so maybe i should have looked up the mongoose documentation
[23:42:57] <Boomtime> if that is what you're using, then you'll need to use that