PMXBOT Log file Viewer

Help | Karma | Search:

#mongodb logs for Monday the 29th of June, 2015

(Back to #mongodb overview) (Back to channel listing) (Animate logs)
[00:33:58] <jecran> db.test.find( { a: { $exists: true } } ... what is the most efficient way to search for 2 different values? (can be from different records)
[00:34:50] <jecran> I have 2 values to test, and want to check if any records contain either value
[00:37:58] <partycoder> you mean
[00:38:06] <partycoder> what is the most efficient way to scan the entire collection for a value?
[00:38:15] <partycoder> is that your question jecran?
[00:38:24] <jecran> 2 values, only reading the database once
[00:38:38] <partycoder> the answer is
[00:38:43] <partycoder> never scan the entire database
[00:38:57] <jecran> good answer lol
[00:38:59] <partycoder> databases scale because you make use of indices
[00:39:11] <partycoder> you either look for an index or
[00:39:53] <partycoder> forget about having online transactions
[00:40:39] <jecran> so use an index
[00:40:41] <partycoder> so i really suggest you reconsider coming up with an alternative schema
[00:41:03] <partycoder> db.test.find({_id: value})
[00:41:28] <partycoder> or you can add an index with collection.ensureIndex
[00:41:38] <cheeser> jecran: you want to find all documents that have either 'a' or 'b' ?
[00:41:49] <jecran> well all my values in this collection will be unique..... yes cheeser
[00:42:02] <partycoder> more like
[00:42:11] <cheeser> so wrap your $exists check in a $or
[00:42:11] <partycoder> i want to lock my database in production
[00:42:14] <jecran> I mean, if they contain 'a' or 'b'
[00:42:44] <partycoder> i suggest you after you come up with a solution
[00:42:52] <partycoder> you take that query, and add .explain() to the end
[00:42:57] <partycoder> get the execution plan
[00:43:06] <partycoder> go through it and try to understand what is happening
[00:43:08] <jecran> good clal
[05:02:26] <fixl`work> Hello there. Can I ask Morphia related questions in here as well?
[05:21:04] <pylua> I insert doc with pymongo.insert(),then I do not find() the doc out ,why ?
[08:40:02] <schamane> hi guys
[09:17:01] <coudenysj> hi schamane
[10:20:24] <leporello> Hi. I'm using mongoose and get an error: { name: 'MongoError', message: 'getaddrinfo ENOTFOUND' }
[10:27:56] <leporello> Hm. Missing the parenthesis in ternary operation caused wrong string to connect.
[11:16:50] <flok420> I'm trying to count the number of occurences of a certain value. e.g. 0.1...0.2 should be counted, 0.2...0.3, etc. I tried the following but it says that it did not expect ':' without any further indications which : it did not expect. any suggestions?
[11:16:50] <flok420> db.data.group(key : { }, cond : {'ts' : { '$gt' : 1435487780 } }, initial : { counts : [] }, reduce : function(curr, result) { result.counts[int((curr.value - 0.0) / (0.24-0.0) * 10.0)]++ })
[11:29:57] <symbol> If I'm only doing bulk writes, is there and advantage to using the Bulk api vs inserting with an array?
[11:32:31] <cheeser> probably depends on the driver
[11:33:44] <symbol> Good point, I'm working on some lesson plans but am using the MongoDB shell to teach it. I'm debating going over bulk operations due to the variety of driver handling.
[11:38:42] <zamliman94> hey
[11:38:57] <zamliman94> Is it possible to use geoNear combined with group ?
[11:39:39] <zamliman94> the geoNear sorting is lost with group, and i cannot use geoNear after group, because geoNear has to be the first in pipeline order
[13:11:24] <zamliman94> any tips for advanced sorting in mongodb?
[13:40:32] <coudenysj> zamliman94: do you have a specific question? :)
[16:41:48] <dorongutman> hello
[16:46:46] <dorongutman> I have a social activity-like collection, with documents that look like this: http://pastebin.com/kq6qnUtJ. as you can see there’s 3 “status” creations and then a “delete” on one of them.
[16:47:28] <dorongutman> how can I get all the items that were created but not deleted (if they were deleted I need to get just the delete) ?
[16:48:16] <dorongutman> I tried with the aggregation framework but I can’t seem to get it right - $group loses the data on the document, and I don’t know how I get the delete itself (which must be the most recent one)
[16:49:39] <StephenLynx> imo, you would be better with a separate collection.
[16:49:55] <StephenLynx> wait
[16:49:56] <StephenLynx> nvm
[16:51:20] <GothAlice> dorongutman: $group on the "group" dbref, collect ($addToSet) the actions to create a new list of all actions for each group, then $match on that ($and the "actions" list containing the action you are looking for and $not the delete action). You can then project/unwind/etc. from there.
[16:52:38] <GothAlice> However, likely if it exists it was created (this is a simplified case), so you can very simply $group on the "group" field, collect the actions ($addToSet), and $not the actions containing "delete".
[17:18:43] <dorongutman> GothAlice: thanks. I’ve gotten up to the collect the actions with $addToSet (I think) but now how do I $not the actions contatining delete, and how do I get the original document (instead of just the grouped properties) ?
[17:18:50] <dorongutman> this is what I have: db.EventLog.aggregate([{$match: {'group.$id': ObjectId('5591566e279871e5267b23c6')}}, {$sort: {'loggedTimestamp': 1}}, {$group: {_id: {"effectedId": "$effectedId"}, "actions": {$addToSet: "$action"}}}])
[17:19:13] <dorongutman> (the effectedId is the id of the created/deleted status)
[17:20:56] <dorongutman> GothAlice: actually - I do need the “delete” actions themselves, but not the “create” on the items that got deleted
[18:28:34] <fxmulder> if I have a replica set that used to have sharding enabled but now for some reason doesn't think it is enabled, how do I get it set back up as a shard member?
[18:28:57] <cheeser> did you try readding the RS from a mongos?
[18:29:38] <fxmulder> mongos still sees it as being a member
[18:29:57] <cheeser> strange
[18:36:14] <fxmulder> what on a replica set tells it if it is part of a shard set?
[19:10:37] <grandy> hello, wondering if there is a recommended tutorial for understanding what mongoose can do .. i've used "raw" mongo before but now working on a codebase that uses mongoose, trying to figure out which approach will be best for writing some report
[19:10:37] <grandy> s
[19:11:20] <StephenLynx> most people here just advice to not use it. but since the codebase already uses it, I don't think thats an option.
[19:11:31] <StephenLynx> unless you can just strip mongoose usage from stuff that you touch :^)
[19:12:59] <grandy> StephenLynx: interesting... ok
[19:13:08] <grandy> StephenLynx: so you'd recommend just raw mongo?
[19:13:49] <StephenLynx> yes
[19:15:09] <cheeser> by "most people" he means him. :)
[19:15:24] <grandy> cheeser: ahh ok so do you agree?
[19:15:26] <StephenLynx> gothalice also said it sucks
[19:15:34] <StephenLynx> multiple times
[19:15:51] <cheeser> i'm a java guy so my advice would be to not use javascript in general :)
[19:16:03] <StephenLynx> is not about js
[19:16:10] <StephenLynx> is about the runtime environment.
[19:16:49] <grandy> not sure i can handle that much heartache
[19:16:59] <StephenLynx> node, an now io, is one of most performatic, if not the most, scripted runtime environment for web.
[19:17:27] <StephenLynx> especially when it comes to handling high levels of concurrency.
[19:18:30] <StephenLynx> is not a language for the liberals at heart.
[19:18:33] <grandy> yeah hoping es6 + strong mode and strict mode will hep prevent some of that oddness... not minding es6
[19:19:01] <StephenLynx> es6 is bollocks, if you ask me
[19:19:35] <GothAlice> Adding more to remember always makes things simpler, amirite? ;P
[19:20:05] <StephenLynx> that is why people use in lint a settings that force the use of === and !==
[19:20:19] <StephenLynx> which isnt ambiguous like == and !=
[19:20:36] <StephenLynx> regular comparison is all over the place in js
[19:20:36] <GothAlice> So "ignore half your language, since it's crap" is acceptable. I find that weird.
[19:20:41] <StephenLynx> welp
[19:20:41] <GothAlice> ;P
[19:20:42] <StephenLynx> V8
[19:21:03] <StephenLynx> I agree the language as a whole is bad
[19:21:09] <StephenLynx> but again, is not about js
[19:21:22] <cheeser> how is *that* not about js?
[19:21:43] <StephenLynx> people that use node and io
[19:21:48] <StephenLynx> they do not use it because of js
[19:21:56] <StephenLynx> they use it because thats what node/io uses
[19:22:02] <StephenLynx> and node/io uses it because thats what V8 uses.
[19:22:03] <cheeser> ah
[19:22:10] <cheeser> there's always vert.x :D
[19:22:12] <GothAlice> StephenLynx: Which any language, esp. ones supporting coroutines, can do. ;^P
[19:22:32] <StephenLynx> tell google about that
[19:24:30] <StephenLynx> the creator of node said himself, he never chose js, he chose V8
[19:24:41] <cheeser> that's ... weird.
[19:27:59] <GothAlice> I mean, if you have to pick a virtual machine to run bytecode in, it's hard to beat the JVM. Really.
[19:29:10] <cheeser> agreed.
[19:29:34] <cheeser> one that even has proper threading support!
[19:29:34] <cheeser> :D
[19:30:18] <cheeser> i've been loving kotlin lately. also transpiles to js. just saying. :D
[19:30:29] <GothAlice> :P
[19:30:34] <StephenLynx> but theres that thing
[19:30:39] <StephenLynx> the design of node is not about threading.
[19:30:51] <StephenLynx> it is designed around being single-threaded.
[19:30:59] <GothAlice> StephenLynx: That's beside the point.
[19:31:19] <StephenLynx> and he wanted to use a scripted runtime.
[19:31:22] <StephenLynx> not a bitecode
[19:31:39] <StephenLynx> bytecode*
[19:32:11] <GothAlice> Hint: if it's "interpreted", it's running a bytecode virtual machine behind the scenes. The compilation step is just hidden from you in most cases. (I.e. the typical "PHP throwing out the compiled bytecode after each request" problem solved by bytecode caches, etc.)
[19:32:40] <StephenLynx> I know, but woudn't using JVM require it to be compiled to bytecode beforehand?
[19:32:49] <StephenLynx> plus, JVM isn't that faster than V8
[19:32:50] <StephenLynx> "{"name":"Anonymous","signedRole":"Board owner","email":null,"id":"6dfa4a","subject":null,"markdown":"a","message":"a","creation":"2015-06-29T19:05:46.467Z","files":[{"originalName":"397.jpg","path":"/second/media/10.jpg","thumb":"/second/media/t_10.jpg","name":"10.jpg","size":64488,"width":447,"height":400}],"postId":51}"
[19:32:52] <StephenLynx> damn it
[19:32:55] <StephenLynx> http://benchmarksgame.alioth.debian.org/u32/javascript.php
[19:33:01] <GothAlice> That VM may boil things down to machine code in the end (JIT and whatnot), but it's still using a parser -> AST -> compiler -> bytecode translation process.
[19:33:42] <GothAlice> StephenLynx: Speed isn't everything. The JVM rocks because of speed, AND everything else it does.
[19:34:22] <fxmulder> what on a replica set tells it if it is part of a shard set?
[19:34:44] <webjay> Can I have both replication and slaves?
[19:34:58] <cheeser> as in master/slave?
[19:35:01] <webjay> yes]
[19:35:09] <cheeser> i'd be surprised if you could
[19:36:09] <webjay> would it the be possible to have a replica that some can only connect to, so their queries can't hurt the master?
[19:36:36] <webjay> or other replicas
[19:47:42] <webjay> it seems a hidden replica is what I want
[19:49:47] <cheeser> replica sets aren't really the best option for scaling reads. you'll want sharding for that.
[20:51:30] <hahuang65> joannac: thanks for your help in our ticket a few weeks ago :) Never got a chance to respond.
[21:44:21] <kaliya> Hello, I have a dedicate partition for mongo data. With a replicaset on mydb, what's the best way to not make mydb.* files to fill 100% the partition? Is there some limit option? Mongo 2.4
[22:23:24] <benjick> Is there a way to do this I'm trying to achive? https://gist.github.com/benjick/2a262acc33bf227c038c
[22:47:48] <grandy> can anyone explain the meaning of the terms in an aggregate group clause? not sure i understand the quoted string with a $
[22:50:50] <Doyle> Hey. How much are the Enterprise Advanced subscriptions? Just looking to get OpsManager for backups.
[22:57:08] <grandy> newb question: for this query why does it fail if I substitude _id with something else? db.mycollection.aggregate([ {$group : {_id: "$a", count: {$sum: 1}}}])
[23:00:22] <grandy> any recommended way to quickly get up to speed on aggregates? any good online tutorials?
[23:34:46] <Freman> [[09:27:21.202]] [ERROR] { [MongoError: Executor error: Overflow sort stage buffered data usage of 35067470 bytes exceeds internal limit of 33554432 bytes] name: 'MongoError' }
[23:34:48] <Freman> *cries*
[23:35:50] <Freman> not even asking that much of it
[23:35:51] <Freman> {task_id: this.task._id}, '_id date duration pid code server failed', {sort: {date: -1 }, limit: limit}
[23:36:08] <Freman> there might be up to 1k records
[23:50:25] <Freman> I suspect it's loading up the 10+ mb 'messages' field for sort/limit even tho I've not asked for it