[01:52:25] <drags> not in the interactive shell, but running a js file: mongo my_script.js
[01:52:44] <cheeser> well, they're functionally the same at that point
[01:52:47] <drags> I'm setting up sharding and I need to enumerate all of my collection index keys so I can plan my shard keys
[01:53:31] <drags> cheeser: how can I concat my collection names (read into an array using db.getCollectionNames()) into the db.<collection>.getIndexKeys() call?
[01:54:22] <cheeser> var names = db.getCollectionNames()
[08:32:24] <Folkol> Hello, mongodb is logging (what seems to be?) all queries - filling up my disk. The db.getProfilingLevel() is set to "0". How can I disable this logging?
[08:34:46] <Folkol> Yes, it is set to 0 for all databases.
[08:35:00] <Folkol> The one that I am using for my app, and "local" / "test", whatever that is.
[08:35:40] <Folkol> I have read that it always logs slow queries, but I do not know how to distinguish "normal" profiling logs from "logs due to slow queries".
[08:36:40] <kali> well, to be honest, i never use the "0" setting
[08:36:56] <kali> so i can't say it works, but it has been around for so long...
[09:30:20] <queretaro> Hi - In http://docs.mongodb.org/manual/core/backups/ it says that mongodump is not ideal for backing up large systems, might anyone provide a little bit more of an explanation regarding this?
[09:31:16] <kali> well, mongodump means that all the data has to flow through one mongos -> mongobackup connection, so it has a finite bandwidth
[09:31:34] <kali> you can in a situation where you need more than say, 24h to get all the data through
[09:36:36] <queretaro> kali: oh I see, makes sense thanks
[09:49:28] <Spea> Hey there. I want to create a new index in the background on one of my collections. The documentation states that with 2.4 indexes on secondaries will always be built in the foreground. Does that mean, that when the index creation on the primary finishes, all secondaries will block the collection?
[09:53:35] <lqez> It says “Changed in version 2.6: Secondary members can now build indexes in the background. Previously all index builds on secondaries were in the foreground.”
[09:54:37] <lqez> (Actually, I was stuck on simliar problem at 1.6 lol http://stackoverflow.com/questions/11649767/mongodb-copydatabase-runs-index-creation-on-foreground-not-background)
[09:55:30] <kali> wow 1.6, you're an oldtimer too :)
[09:55:56] <lqez> I'm still using 2.4 in production.. waiting for 2.8
[09:57:19] <lqez> when does 2.8 (non-rc) come out?
[09:57:34] <Spea> does anybody have a clue how long it would take to create an index on a collection with 17M rows?
[10:05:29] <Folkol> kali (and others who might be interested): The log-spam was due to slow queries, it seems like mongod is logging slow queries despite profilingLevel being set to 0. I added an index and the log went silent.
[10:06:21] <kali> well, that's certainly the best fix
[11:03:28] <giuseppesolinas> I'm getting Could not stat /dev/xdf --- No such file or directory when trying to install on EC2, what are the elegible partitions that I can use for mongo as in http://docs.mongodb.org/ecosystem/platforms/amazon-ec2/#deploy-mongodb-ec2 ?
[11:12:51] <lqez> giuseppesolinas: ‘Individual PIOPS EBS volumes for data (1000 IOPS), journal (250 IOPS), and log (100 IOPS)’
[11:13:24] <lqez> You have to mount IOPS EBS by manually.
[11:13:42] <lqez> Or you can use marketplace for just tasting mongodb
[11:38:18] <giuseppesolinas> is it normal for mongod to take a while to boot up? A couple of minutes and it hasn't booted up yet
[11:39:10] <giuseppesolinas> ok, it was first run, took a while but now it's normal
[11:43:01] <kali> giuseppesolinas: you may want to check that you've put the data on a ext4 partition and not ext3
[11:43:27] <giuseppesolinas> kali, I think it should be ec4
[11:44:03] <giuseppesolinas> otherwise I won't be able to change it because it's the main partition and I have this ami
[11:44:44] <kali> you DONT want to run prod on ext2 or ext3
[11:47:01] <giuseppesolinas> kali, that's unlikely, if so , it's not very much of my business
[11:49:59] <giuseppesolinas> of course, if I am running my app and my database on the same machine I should refer to the mongo address as "localhost", right?
[12:30:45] <adrian_lc> hi, how can I use 2.4 authentication with a 2.6 installation
[12:31:55] <adrian_lc> I'm getting this error no matter what I do Error: couldn't add user: User and role management commands require auth data to have schema version 3 but found 1 at src/mongo/shell/db.js:1004
[12:32:40] <adrian_lc> I don't wanna update the auth schema cause ansible doesn't seem to support the new version yet
[12:51:11] <tommy_the_dragon> I want to do an update using the java driver. I have the JSON for the update I wish to make in a string. Is there an easy way to turn that into a DBObject?
[12:54:04] <tommy_the_dragon> I'm probably struggling with the basics on how to use the driver. Can someone link me a decent tutorial?
[13:25:27] <cheeser> i wouldn't use BSONObject directly
[15:40:00] <jiffe> Mon Jan 12 08:25:24.159 Invalid access at address: 0x706eeb27dcc8 from thread: repl writer worker 1
[15:40:05] <jiffe> is that a known issue in 2.4.12
[15:41:49] <StephenLynx> I just saw some benchmarks where postgresql nosql tools outperformed mongodb by over 2 twice the speed. anyone here has something so say about that or knows if anything changed in the last year? or does really postgre outperforms mongo?
[16:10:58] <theRoUS> i'm having trouble formulating a query using regexes. i want to find all records where {'short_description':/CRITICAL/} AND {'$not':{'short_description':/ACK/}}
[16:22:57] <Derick> and I think so must you in mongodb then
[16:23:58] <StephenLynx> I remember using $and with regex
[16:24:06] <StephenLynx> hold on, I will look for it
[16:25:07] <theRoUS> comprends.. but how? 'short_description' can't be the selector key, since regexes are dyadic. can't say 'short_description':{'$and':[{'$not':/ACK/},/CRITICAL/]} can i?
[16:32:10] <theRoUS> Derick, StephenLynx: got it. that works. probably totally ignores the index on that field, but once cached it's pretty fast. about a second to pick out 26_000 records from 100_000
[16:33:08] <StephenLynx> yeah, using a regular list for an AND gate is not very intuitive.
[16:33:37] <StephenLynx> and yes, from what I remember from the docs, regex does not uses indexes.
[17:53:37] <StephenLynx> instead of a travesty of relational db like mongoose
[17:54:10] <anybroad_> Pardon my ignorance, what would be the use cases for mongodb? I heard about it and like its flexibility - how can I make it useful for me?
[18:10:53] <StephenLynx> http://stackoverflow.com/questions/9412341/mongodb-is-dbref-necessary "Dbref in my opinion should be avoided when work with mongodb, at least if you work with big systems that require scalability.
[18:10:53] <StephenLynx> As i know all drivers make additional request to load DBRef, so it's not 'join' within database, it is very expensive. "
[18:13:53] <StephenLynx> so you deal with the lack of relations by keeping your relations to a minimum
[18:14:05] <StephenLynx> because if you start relating, you will have performance issues.
[18:14:23] <StephenLynx> and will just be using a crippled version of what relational databases already do.
[18:14:29] <cheeser> that SO post is ... interesting.
[18:15:09] <StephenLynx> it doesn't surprises me. mongodb is not designed for relations, period. even if it implements the semantics, it does not work around that.
[18:15:26] <cheeser> and by interesting i mean misguided.
[18:15:40] <anybroad_> SO post = Stack Overflow post?
[18:15:52] <StephenLynx> ok, what would be your counter-point to that post?
[18:16:24] <StephenLynx> because both you and his posts don't give any data, but his makes more sense because of how mongo is designed.
[18:16:36] <cheeser> there's nothing inherently wrong with DBRefs. the choice to use embedded documents versus references is a bit more nuanced than "never do this" or "always do that"
[18:16:56] <StephenLynx> but it stills just makes additional queries?
[18:18:12] <StephenLynx> "To resolve DBRefs, your application must perform additional queries to return the referenced documents. Many drivers have helper methods that form the query for the DBRef automatically. The drivers [1] do not automatically resolve DBRefs into documents."
[18:21:18] <cheeser> i'm saying be smart about it based on your app
[18:21:32] <StephenLynx> mongo still is not designed around relations.
[18:21:43] <StephenLynx> and anything you use is just a travesty in the literal sense of the word.
[18:21:47] <cheeser> is mongo a bad fit? maybe. but maybe not. and no single sound bite from an internet forum is going to adequately answer that question.
[18:25:56] <StephenLynx> and when fetching the books, just fetch it's category
[18:26:00] <drager> How do I make mongodb accept external ips? Because I have one website running that db and a site and I have one android application which needs that data from that server. But if I accept external ips will that result in a security flaw?
[18:27:44] <StephenLynx> a good architecture is to have an application running on the server that will accept http requests, query the database and output a response.
[18:28:09] <StephenLynx> anybroad_ a second lookup? if you wish to see the details of the category, yes.
[18:28:25] <StephenLynx> otherwise, no. you just display the category of the book.
[18:28:28] <anybroad_> StephenLynx: ah, I use the category name in category field, so I know it already
[18:28:39] <anybroad_> StephenLynx: what is about a slug (urlized/shorted name)?
[18:28:46] <anybroad_> or do I simply put both into that field?
[18:29:02] <StephenLynx> I would use what I want to show in the GUI already
[18:29:22] <anybroad_> StephenLynx: as I do the same (the problem there is that your fron-end is connecting to your database), how should this function then?
[18:29:28] <StephenLynx> so I don't have to have two fields and update the books if I change the display name
[18:29:48] <StephenLynx> you are not connecting the FE to the database, you are just using an unique field as any other
[18:29:59] <anybroad_> StephenLynx: ok, so only the category name, and 2nd query is performed to look up the slug of category.
[18:30:01] <StephenLynx> you just happen to use the field that is the display name of the category
[18:30:11] <StephenLynx> slug? details of the category?
[18:30:28] <anybroad_> slug means in this case a short name of category to be used in urls for example
[18:30:40] <anybroad_> long category thing -> short-category
[18:31:29] <StephenLynx> I would either use the long name or use the body of the request for the parameters instead of the url
[18:32:14] <anybroad_> StephenLynx: pardon my ignorance, 'body of the request'?
[18:37:21] <StephenLynx> I would save both on the books
[18:37:21] <drager> cheeser: Shouldnt it work just binding mongo to 0.0.0.0 for it to accept external ips?
[18:37:54] <StephenLynx> drager if you accept external ips make sure you enable authentication. but you really should just put a webserver running to perform the queries
[18:56:40] <StephenLynx> node just executes the function you gives it when you start listening to a connection
[18:56:50] <StephenLynx> and you do anything you want from there
[18:58:08] <StephenLynx> express just hides it under a bunch of crap that nodes have to dig through to reach your code
[19:01:03] <anybroad_> StephenLynx: So I use express-validator, express-session, express-error-handler and express-enrouten
[19:01:14] <anybroad_> But those are standalone modules, they had been taken out from express to do one thing.
[19:01:25] <anybroad_> I can still use them as they only bear the name 'express'?
[19:05:27] <drager> StephenLynx: I have a webserver running with websockets pushing the data but Im currently getting; (android:http://meteor.local/:0) XMLHttpRequest cannot load http://domain.se/sockjs/info?cb=firnycyccl. Origin http://meteor.local is not allowed by Access-Control-Allow-Origin.
[19:23:51] <StephenLynx> I just fiddle with the URL
[19:24:11] <StephenLynx> vanilla has already enough functions to help you with that
[19:25:19] <anybroad_> StephenLynx: So the html in https://gitlab.com/mrseth/lynxchan/tree/master/src/fe are served statically as normal html to browser?
[19:25:41] <anybroad_> StephenLynx: and could you give me a line in your example where references are de-normalized? Because I want to learn more about this.
[19:30:23] <StephenLynx> i will link you my other project
[19:30:38] <anybroad_> StephenLynx: because I would have to do the same when a category is removed, the products must forget that category then or even removed altogether.
[19:31:30] <StephenLynx> https://gitlab.com/mrseth/bck_leda/blob/master/pages/delete_forum.js line 18
[19:31:51] <StephenLynx> in your case you would have to remove the field, there is an operator for that
[19:32:03] <StephenLynx> in my case I remove the forum from the list of forums the user has joined
[19:33:23] <StephenLynx> https://gitlab.com/mrseth/lynxchan/blob/master/src/be/public/setGlobalRole.js line 24
[19:33:40] <StephenLynx> it deletes a field from an object
[19:34:38] <StephenLynx> you would have to deal with books with undefined category.
[19:34:49] <StephenLynx> if you implement category deletion
[19:35:02] <StephenLynx> or pick a category and set it instead
[19:35:06] <StephenLynx> whatever floats your goat.
[19:37:38] <LuckyBurger> hey quick Q: if i have a node.js object with functions and i save it to a mongodb collection, when I pull it back out will it still have the prototype functions still on the object ?
[19:37:59] <cheeser> what happended when you tried?
[19:38:10] <LuckyBurger> havent, trying to plan out my object structure
[19:38:37] <StephenLynx> no idea. I wouldn't consider it good design though.
[19:39:08] <StephenLynx> because then your database is coupled to your back-end
[20:18:38] <winem_> hey guys, did anyone ever participate in the courses from mongo university? unfortunately, I was not able to watch all the videos of the first chapter, due to some critical issues at work.. chapter 2 starts tomorrow evening. would just like to know whether the videos and quizzes from chapter one will still be available after chapter 2 started
[20:19:38] <cek> what's the sense of having $elemMatch operator if you can just use {$gte: xx, $lt: yy} compound statement,for ex.,?
[20:20:50] <octoquad> hi winem_ I did, just completed homework for this week. Not sure if it will be, but maybe you can ask the question on the discussion tab.
[20:24:13] <octoquad> any mongodb developers here?
[20:24:20] <winem_> did not see it yet. thanks octoquad
[21:47:34] <cek> guy, why is mongo not resetting iterator when doing map and forEach?
[22:00:46] <sellout> Is { "$elemMatch": { "$eq": 4 } } the right thing to do? "$eq" doesn’t seem to be documented, but { "$elemMatch": 4 } errors with something like “argument to $elemMatch must be an object”.
[22:04:38] <suupreme> Hi, I am using mongodb together with Go. I am writing some test now where I create a struct of a user. In the test I set the ObjectId. When I insert it in the test-db and try to query it back I can't by id but I can see the exact same user in there with exact same Hex of the id but in the test-struct it was a "1" at the end and in the db it became an "a" any ideas?
[22:05:10] <suupreme> so to summarize mongo replaced the last char in the object id, why?
[22:05:14] <StephenLynx> _id? mongo sets a value for it automatically
[22:05:42] <StephenLynx> you will have to deal with mongo doing stuff with the _id field. for one I don't touch it
[22:05:53] <cek> Is it possible to .find() and then .aggregate() the results? why not?
[22:06:04] <cek> i need to do a simple concat of 2 fields.
[22:06:06] <suupreme> StephenLynx: so _id is not a good "identifier"?
[22:06:39] <StephenLynx> because find returns an array of pointers, aggregate returns an array and both are methods of the collection poiter
[22:06:56] <StephenLynx> suupreme not for you to be messing with it, afaik.
[22:07:12] <StephenLynx> just get it back from the insert operation
[22:07:15] <suupreme> StephenLynx: I don't mess I just precreate an id with go
[22:10:22] <StephenLynx> so lets say I have a list of forums the user joined. instead of making an array with _ids, I set the forum name as unique and make a list of forum names in the user.
[22:10:37] <StephenLynx> that way I can show the list without a second query based on the _id's
[22:13:27] <sellout> StephenLynx: But I have a field with an array of numbers … there are no subfields.
[22:17:19] <StephenLynx> your array of number is a subfield, isn't?
[22:17:41] <StephenLynx> because a collection is an array of objects in the first place
[22:18:14] <sellout> StephenLynx: But I can’t filter on $$ROOT, can I?
[22:19:43] <sellout> If I have a doc that looks like { …, nums: [4, 2, 1], …}, I want to aggregate([{ $match: { nums: { $elemMatch: { $eq: 4 } } } }, …]).
[22:21:30] <sellout> $eq seems to have appeared in 2.6, but I could find no mention of it, which makes me worry that it might break.
[22:27:37] <winem_> a login with authentication agains the admin db works fine
[22:27:45] <winem_> so I guess I just mix up both dbs but try to fix this for 15 minutes now...
[22:28:23] <winem_> what am I doing wrong? I don't get it..
[22:30:14] <sellout> StephenLynx: I don’t have a model. I’m working on a SQL->MongoDB compiler (http://slamdata.com) and am basically implementing `where 4 in someField`. Zips will work, though: { $match: { loc: { $elemMatch: { $eq: 43.058514 } } } } is what I currently generate from `select * from zips where 43.058514 in loc`.
[22:30:50] <sellout> Previously, we just used a $where in this case, but I saw $eq used somewhere, and it worked.
[22:42:29] <StephenLynx> then why not just {someField: 4}?
[22:42:30] <winem_> got it. helped to read the documentation about the authorization process itself once again
[22:43:29] <cek> how do I count aggregated results?
[22:43:32] <sellout> StephenLynx: Can you write out the full $match, because I think I’m missing something.
[22:43:37] <cek> TypeError: Object #<Object> has no method 'size'
[22:44:54] <sellout> StephenLynx: someField doesn’t contain a number, it contains an array of numbers.
[22:45:00] <StephenLynx> cek: length, it is an array
[22:45:20] <StephenLynx> sellout sec, I will get a snippet from a project of mine
[22:45:22] <cek> ReferenceError: length is not defined
[22:45:26] <cek> TypeError: Object #<Object> has no method 'length'