[00:09:55] <bjori> there is also a rest interface if you enable it, although thats not very good or fully featured :)
[00:11:13] <spuder> thanks. What I really need is to run the following lines of code in a script (use admin; db.auth(foo,bar); ect...)
[00:11:39] <spuder> It looks like there may be a way to do this here: http://docs.mongodb.org/manual/tutorial/write-scripts-for-the-mongo-shell/
[01:46:02] <ruffyen> spuder: can you execute .js files?
[02:16:42] <harttho> In the Aggregation Framework, which pipeline stages are limited by the 16MB max. For instance, Match -> Group -> Project… does the 16MB limit matter for each, or just the overall
[02:52:47] <spuder> ruffyen yes, I made a .js file and I am able to execute it
[02:53:10] <ruffyen> yeah thats probably your best bet
[02:54:17] <k_sze[work]> So in the native mongo client, the ordering of keys in the spec matters, but I guess that cannot be true when using pymongo? because there is no guarantee of key ordering when using a python dictionary.
[02:55:58] <ruffyen> k_sze[work]: i dont think i follow
[03:03:42] <k_sze[work]> Not sure if there is any other kind of query where the field order matters.
[03:04:49] <k_sze[work]> So given this, I guess the requirement for exact field order in subdocuments is lifted when using pymongo because there is no guarantee of key order in a python dictionary.
[06:01:37] <pneftali> hi guys - in my /data/db folder, i got several files with this filename pattern: worker, worker.0, worker.1, worker.ns and are taking a significant amount of disk space.
[06:02:56] <pneftali> should I delete everything and leave just worker file ?
[06:06:17] <joannac> They're the files in which your data is stored
[06:06:25] <joannac> They get pre-allocated as you need them
[06:09:07] <pneftali> joannac: my worker collection only have less than 100 documents, so prolly just a few kbytes. worker.x however are taking x gig disk space
[06:14:06] <joannac> pneftali: let me clarify, did you delete the .ns file?
[06:14:23] <pneftali> joannac: nope, just the .0 and .1
[06:14:51] <joannac> pneftali: So what files do you have?
[06:18:41] <joannac> You can see it because it's cached in RAM
[06:19:01] <joannac> If your server crashes, or you restart mongod, you'll have nothing
[06:20:01] <joannac> I suggest you try getting as much of it back as possible
[06:21:36] <pneftali> joannac: oh. data is gone. facepalm
[06:22:33] <pneftali> joannac: why is mongo generating .x files again ?
[06:23:31] <joannac> because it preallocates file so it can save data without the costly pre-allocation step in the middle
[06:23:53] <pneftali> joannac: i only have a limited amount of disk space and no plan on adding more. if this is the way mongo is operating, then i should just go back to sql :D
[06:24:15] <joannac> Otherwise, you almost fill up a data file, save one extra document, need a new data file for the new document, wait to pre-allocate, and the user goes "I'm saving a tiny document when it this taking so long?"
[06:24:23] <joannac> pneftali: run with --smallFiles ?
[06:28:39] <pneftali> joannac: how often does mongo pre-allocates files, every time there's an update to the document ?
[06:28:52] <joannac> no, it allocates 1 file in advance
[06:29:04] <joannac> so it'll be writing to blah.0 and have blah.1 allocated
[06:29:13] <joannac> when it needs blah.1, it'll allocate blah.2
[06:30:46] <pneftali> joannac: ok. is it safe to delete the blah.0 then when blah.1 and blah.2 exist ?
[10:22:10] <bahamas> hello. what's the best way to find the maximum id in a collection? I need to iterate over a huge collection and want to do it in ranges
[10:33:14] <cedricziel> Hehe, yes, i just read an article where one guy states that mongo was the wrong solution to their problem. But this doesnt apply to 99% of applications, I think
[10:33:28] <ron> funny thing, that guy was a girl.
[10:33:37] <ron> assuming we're talking about the same article.
[10:34:03] <cedricziel> damn right, sorry for that ;)
[10:36:15] <ron> even without reading it, I imagine it was "let's try to use a document-based database to store information in they way we *think* it should work" so.. more like trying to shove a square into a circle-shaped hole.
[10:36:42] <ron> which eventually leads to - use right tool for the job, and when you use the right tool, use it properly.
[10:37:23] <cheeser> or as the raven guy said it, "don't run if you can't tie your shoes."
[10:37:40] <cheeser> which might be one of my favorite quotes ever.
[10:37:45] <kali> ha yeah, the diaspora article... i would not pay much attention to that :)
[10:38:26] <ron> actually, I think such articles are very important as they help drive things forward. even 'wrong' concepts should be voiced so that people could learn that they're wrong.
[10:38:37] <ron> information exchange is vital for progress.
[10:39:17] <cheeser> the problem is that those wrong voices often get propagated separate from the correctional ones.
[10:39:32] <cheeser> but certianly, dialog is the best way to learn.
[10:39:48] <ron> and in fact, if the article (which I haven't read) was descriptive enough as to *why* she thinks mongodb is 'bad', that's even better as it raises issues that can be confirmed or denied. if she just said "mongodb sucks", that's just useless.
[10:40:26] <ron> well, an inquiring mind shouldn't rely on a single source to draw conclusions. that's why the ravendb post is so important.
[10:41:04] <cheeser> you should read the comments on her post, then. :D
[10:41:46] <ron> that reminds me of an article I once read about some benchmarks some guy did in java comparing a few things.. the thing is that what he did was micro-benchmarking, and he's done so very poorly. the results were there, but I have no doubt they were wrong.
[10:41:54] <kali> ron: somebody summarized it as "don't use mongodb because we got it totally wrong", and it's quite good
[10:42:10] <ron> I mocked the article quite a bit on irc, but didn't bother writing a comment or saying publicly why it was wrong.. so that's my bad for that matter.
[10:42:24] <ron> kali: it's actually not the first anti-mongodb post that does that.
[10:43:22] <ron> on the other hand, there was an article on lifehacker (back when I still read it) about why java is bad and should be removed from most computers. of course it related to applets and not java itself, but it was written to the simple user and was generalized.
[10:43:54] <ron> in that case I started a 'war' in the comments, and even got the author to modify the article at some of the more crucial points.
[10:44:26] <ron> damn Sun for its stupid applets *facepalm*
[10:46:14] <cedricziel> i dont judge mongo by a single source-i'm just researching, which aspects we could benefit from, and which could throw stones upon us
[10:46:56] <ron> there *are* things I don't like about mongodb and prefer in some of its competitors, however, you can't have it all.
[10:48:32] <cedricziel> aye, that seems to be one of the more general aspects when you're dealing with specs.
[10:49:46] <cedricziel> maybe you can share some thoughts on wether its a good practice to embed everything you can vs ...a more relational approach. as far as I understood it, embedding documents has massive advantages when it comes to speed compared to referencing documents
[10:50:16] <ron> a relational approach doesn't exist really.
[10:51:02] <ron> as for whether to embed or split, that depends on what/how you read and write in your application. there's no single answer to that.
[10:53:12] <yogurt_truck> Java _should_ be removed from the solar system, though
[10:54:55] <cedricziel> ron you are totally right-are there any resources spending time on clarifying which approaches might fit in several situations? I'm curious to learn about that
[10:55:18] <ron> I don't know of any off-hand, sorry.
[12:02:36] <blackxored> Hello guys, question, I'm query on a embedded document, I need to return documents where the embedded document complies with two conditions, apparently I'm getting a global thing instead of the actual document fullfilling those two
[12:03:06] <blackxored> Can you tell me how to specify that I need embedded docs when both cond1 and cond2 apply on the *same* embedded document?
[12:03:24] <kali> blackxored: check out $elemMatch
[12:07:03] <blackxored> I'm also switching to $addToSet for that array
[12:09:56] <emjsw> Hi, I have a question regarding aggregation and $geoNear. What unit is the distance field calculated in when using spherical index with GeoJson coordinates?
[12:23:50] <emjsw> kali: Doing some testing and it seems to return meters.
[12:25:59] <kali> emjsw: that's what my code gets too, with a 2dsphere and GeoJson points (with degrees)
[12:27:09] <kali> i actually double checked, but there is little chanve of confusing meters with km, rads or degrees once they drawn on a map anyway
[12:28:32] <emjsw> kali: Yeah it's a bit confusing, thats why I went here to double check. I do some of my own conversions when loading the dataset which is not in WGS84, but it seems to be working.
[12:37:50] <kali> emjsw: i reported that as a documentation issue
[12:38:07] <cheeser> yeah. it's pretty vague. even the 2.6 docs.
[12:38:24] <kali> cheeser: haven't checked these out
[12:38:43] <kali> ho, actualy, i was on the 2.6 ones. great.
[12:38:51] <cheeser> that link i posted is from the 2.6 version
[18:10:30] <HoLeeSheet_> when you do a db.foo.find({title: "lol"}) and the result contains an array "friends", what is the best way to query this array (to filter the result directly):, db.foo.find({title: "lol"}, {"friends": []}) seems to work, but doesn't look the right way
[18:18:02] <HoLeeSheet_> db.foo.find({title: "lol"}, {friends:0}) is hiding the friends field in the result
[18:23:28] <HoLeeSheet_> more generally, I'm learning how to refine/filter results, ex: db.users.find({"friends.somefield": "no"}), the thing is it returns all documents in integrality, even if the field firends in this document contain other firends not mathing
[20:42:44] <HoLeeSheet_> just something confusing for me in http://docs.mongodb.org/manual/reference/method/db.collection.update/#add-an-element "The following operation queries the bios collection for the first document where the _id field equals 3 and the ***contribs array contains an element equal to compiler***. If found, the ..."
[20:42:56] <HoLeeSheet_> hard to get what's done between the ***
[20:43:50] <HoLeeSheet_> does it match an element such as {key1: "compiler} ?"
[20:44:46] <HoLeeSheet_> nvm I get it, it's just simple elements
[20:56:19] <tl_> Hi! Can anybody here help with Node.js streaming from MongoDB to Hadoop?
[21:44:06] <lazyPower> Greetings. I'm having some slight trouble with my first steps with MongoDB in C# (I've got a pretty decent setup in rails using mongoid, i didn't realize how much i was leaning on the ODM until now) - when I implement a model consuming the Data Transformation Object - its turning into chunky salsa complaining about being unable to locate the query method for SELECT - which i've included the reference for Mongodb.Driver.Linq; - would anyone have any ide
[21:54:35] <whnunlife> Quick question, is it possible in mongodb, where if I'm saving a document every 10 seconds, then run a query where it finds all documents saved within the last hour, but grouped by each minute? Where I have data in the collection, say tweets, and it adds them up for each minute?
[23:11:04] <talntid> how do embedded objects work in mongodb?
[23:25:55] <pzuraq> So I have a Post document and a Comment document, Post has Many comments. I want to be able to search Posts via a search page without loading all the Comments, but I want to be able to count how many Comments each Post has. Does it make sense to have an array of Comment ids on the Post document, rather than each Comment having a Post id?
[23:34:14] <x0f> pzuraq, just have a countercache on your Post document which you $inc whenever a new Comment is created. if you expect to never have a "huge" amount of comments, (let's say always less than 16k comments with ca. 1k bytes ascii-text per comment) you can even embed them and the load cost is neglectable.
[23:35:52] <pzuraq> yeah I don't expect more than 100 comments per post, no more than 100 posts per query. In that case would it really not be much more expensive to just directly embed the comments?
[23:36:48] <x0f> pzuraq, it depends on your use case, do you expact ppl to search more often than to actually view whole posts with comments?
[23:37:37] <pzuraq> about equal really. Maybe a little bit more searching, but I won't be able to know without analytics.
[23:37:47] <x0f> pzuraq, i'd be a huge fan of embedding, if it wasn't for the 16mb BSON document limit, which will always bite you once you go "viral" ;)
[23:38:35] <pzuraq> that shouldn't be a problem, this is for an issue tracker for small-medium teams
[23:39:59] <pzuraq> even large teams (>50 people) would probably not cause huge issues when it comes to embedding SIZE, but queries could scale a lot
[23:41:01] <pzuraq> Currently I'm using Mongoose and they have references with a populate method (i.e. array of ids) so it's either that or direct embedding I think
[23:43:43] <pzuraq> also I'm planning on releasing it freely, so people would install and use locally, maybe with MongoLiteDB
[23:55:05] <pzuraq> each Issue has many Comments. When searching for the Issues I'd rather not display the comments, but I do want to display the number of comments.
[23:55:10] <retran> but you have to express that explicitly in Mongo
[23:55:30] <pzuraq> My current strategy was to have an array of document ids
[23:55:32] <retran> instead of an imperitive relation like you may be used to in an RDBMS
[23:55:54] <retran> pzuraq, i recoemend you have a separate collection
[23:56:01] <retran> let mongo come up with the doc ids
[23:58:54] <pzuraq> retran: I think I'm going to disagree actually, by having the ids on the Issue document it kills two birds with one stone without adding too many negative factors
[23:59:15] <retran> ok, enjoy maintaining that array of doc ids
[23:59:26] <pzuraq> namely, we get the count of the comments without having to track it manually, and we can load the comments very quickly
[23:59:36] <retran> and then still having to link to that document
[23:59:47] <pzuraq> mongoose is built to do it that way, so that works