PMXBOT Log file Viewer

Help | Karma | Search:

#mongodb logs for Thursday the 22nd of October, 2015

(Back to #mongodb overview) (Back to channel listing) (Animate logs)
[02:14:10] <bkbonner> hi quick question about mongoclient.connect. if I'm using nodejs 12.6, docs say it should return a promise, but it seems to return undefined.
[02:14:48] <bkbonner> am I misunderstanding the docs? http://mongodb.github.io/node-mongodb-native/2.0/api/MongoClient.html
[02:19:33] <StephenLynx> I strongly suggest you update node.
[02:19:48] <StephenLynx> promises were introduced on 4.0 when they merged with io.js
[02:19:56] <StephenLynx> 12.x is really old by now
[02:20:06] <StephenLynx> 0.12*
[02:21:35] <StephenLynx> bkbonner
[02:23:44] <bkbonner> hi
[02:24:01] <bkbonner> I can update to 4.x
[02:24:24] <bkbonner> it looked like they were in 0.12.6
[02:25:19] <bkbonner> but I may have misunderstood what i read.
[02:26:36] <bkbonner> I thought they came w/ harmony
[02:26:39] <StephenLynx> but even then, I don`t recommend using promises.
[02:26:44] <StephenLynx> afaik, they are slow.
[02:27:02] <StephenLynx> and redundant.
[02:29:16] <bkbonner> just installed v4.2.1
[02:29:19] <bkbonner> trying it out now
[02:30:48] <bkbonner> That did the trick. Thank you
[05:34:12] <Fullstack> does mongoose not work well with older nodes such as 10.25?
[05:34:16] <Fullstack> 0.10.25
[07:01:53] <dualbus> Hey, I'm getting 404 for several current tutorials from the manual, for example: https://docs.mongodb.org/manual//tutorial/force-member-to-be-primary/
[07:02:30] <dualbus> I'm not sure if you're aware. BTW, I didn't report an issue because it requested login and it's a bother to register just to report that :-)
[08:10:30] <tamil> hi folks, is there any tool to convert old mongodb configuration file to new yaml format?
[12:10:29] <terabyte> hey. For a site that stores a wish list (assume each item has an id) for a person (who also has an id) is it better to store a single document for a user listing every item on the wishlist, or is it better to store a series of item documents which all have the userid associated with them?
[12:19:23] <symbol> That's really going to depend on your use case.
[12:20:05] <symbol> Do you want to retrieve users and wishlists together all the time? (Granted, you can use projections to not retrieve the wishlst) Do wishlists ever need to be accessed independtly from users?
[12:20:21] <terabyte> I see
[12:20:49] <symbol> If you'd ever need to access wishlists outside of users, reference it.
[12:20:51] <terabyte> a wishlist does not make sense cutting across users. So you always retrieve a wishlist for a single user, or edit an item on a wishlist for a single user.
[12:22:33] <terabyte> so i guess {user:id, items:[{item1, item2}]} makes sense over a series of {item1, user1}, {item2,user1} etc then
[12:23:43] <deathanchor> terabyte: agreed.
[12:24:32] <symbol> yup
[12:24:35] <terabyte> cool thanks
[12:25:35] <symbol> Although, I think some people will argue that arrays without "bounds" aren't a good idea but I don't think rule applies to small arrays
[12:25:57] <terabyte> well the list is about 3000 entries long....
[12:26:18] <symbol> One wishlist for a user has 3000 entries?
[12:26:53] <terabyte> most entries are quite small (read empty), but up to 2000 of them could have 5 'subitems' of information, a subitem of info would be about 5 fields itself
[12:26:54] <terabyte> yeah
[12:27:17] <terabyte> does it now become a question of performance when updating? :D
[12:29:11] <symbol> I like to think of 100 as a soft limit for arrays when you push past that, performance hits may happen.
[12:29:51] <symbol> If a user goes from 3 items to 300 then that document may need to be moved locations.
[12:30:21] <symbol> You'd also see a hit on update speed.
[12:31:00] <terabyte> hmm.
[12:32:04] <symbol> Then again - there's this article https://www.percona.com/blog/2014/02/17/dont-worry-about-embedding-large-arrays-in-your-mongodb-documents/
[12:33:00] <symbol> But that's tokumux doing some magic behind the scenes, which you could also do.
[12:36:00] <terabyte> so 3000 will be created in one go
[12:36:06] <terabyte> after that it's all subedits really
[12:37:52] <symbol> I think that should be ok. I'm curious on other people's opinions.
[12:40:59] <Pacane> Hi, I'm trying to update the mongo driver for Dart, and I'm facing a weird problem. Once I'm authenticated, I try to insert/remove records from any collection and get error messages like this one: "err: not authorized to remove from dbname.collectionName"
[12:41:05] <Pacane> My mongo instance is a free tier mongolab, and my user has the role "DbOwner" (and I tried adding read/write too but it does the same thing)
[12:41:08] <Pacane> Is there some other permission the user needs in 3.x to insert/remove records?
[12:48:14] <sousvide> good morning
[12:48:45] <sousvide> probably a quick question: i have edited mongodb.conf to listen on the actual IP of the server, but "mongo" by itself still tries to connect to 127.0.0.1
[12:48:59] <sousvide> netstat -tlpn | grep mongo shows that it is indeed listening on the real ip and default port
[12:49:11] <sousvide> mongo <with the real ip> does connect, so mongo is running....
[12:49:22] <sousvide> i'm just confused why "mongo" still tries default 127.0.0.1
[13:08:52] <symbol> Oh snap. With the power of 2 allocation in 3.0 - does this mean that, if a document has to be moved, that another document can slide into the now free space?
[13:09:15] <Derick> sure
[13:09:37] <symbol> Previously, that space just would've been unused - yeah?
[13:09:48] <Derick> no, it would have been used if a new doc would fit into it too
[13:10:02] <symbol> Gotcha, the power of 2 just make it more likely then?
[13:10:24] <Derick> yes
[13:10:34] <Derick> because there is a set of sizes of "free" space
[13:10:40] <Derick> and not everything from 256-4MB
[13:11:36] <symbol> Ah - so it goes like: 32, 64, 128, 256, 512 ... 2MB
[13:11:44] <Derick> yes
[13:11:54] <Derick> although i expect it to have a lower and upper boundary
[13:12:01] <Derick> (ie, unlikely there is a 32byte space)
[13:12:39] <symbol> Heh, yeah.
[13:12:53] <Derick> https://docs.mongodb.org/v2.4/reference/command/collMod/#usePowerOf2Sizes
[13:13:46] <Derick> and https://docs.mongodb.org/manual/core/storage/#power-of-2-allocation
[13:14:08] <symbol> I was on the second link, didn't know about the first.
[13:18:06] <symbol> I've been doing a bit of reading on embedding documents within arrays. Wouldn't a major downside be the reader-writer locks that happen? E.g. A blog post and comments. If comments are embedded in each post and a site has REALLY active commenters, wouldn't the read performance get hit pretty bad?
[13:19:03] <symbol> I'm thinking of the index page for all posts. While it doesn't require the comments, it'd be slowed down unless there you cached it.
[13:20:10] <Derick> symbol: yes, you're probably right. But also not really until you've benchmarked it :)
[13:20:30] <symbol> Heh, aren't there three lies? Lies, damned lies, and benchmarks?
[13:20:41] <Derick> that's why you need to make your own
[13:21:06] <symbol> That'd be interesting to benchmark/simulate.
[13:23:51] <symbol> You're right though, it's probably negliable until benchmarked. I was at a meetup where a fellow was making a fuss about the locking in versions <=2.6 and the performance hit but the speaker had used it for logging and had great write performance.
[13:38:47] <pamp> Hi
[13:39:09] <pamp> between Ubuntu 14.04 LTS and Ubuntu 14.10
[13:39:30] <pamp> which U recomended for a MongoDB server ?
[13:39:44] <Moz_> Hi All. I'm new to mongoDB but it seems great so far. I have a question - if I modify the output of the find command using a projection can I sort the objects based on a field which was excluded in the projeciton?
[13:39:59] <Derick> Moz_: yes
[13:40:06] <Moz_> Derick, awesome, thank you!
[13:41:02] <Derick> pamp: later software... I'd pick 15.04 (server edition, 64bit) now though!
[13:44:16] <pamp> MongoDB gives suppport for newer versions of OS?
[13:45:40] <Derick> we only provide packages for LTS, but that doesn't mean it doesn't work on later versions
[13:47:51] <the_german> How can i iterate over a whole collection with find().forEeach(...) . It is my understanding that the cursor doesn't return all results....
[13:49:18] <Derick> hmm, that should work with foreach
[13:51:13] <the_german> Derick: Ok... what could be the reason for "killcursors: found 0 of 1" in my logs?
[13:51:32] <Derick> uh - no idea
[13:51:44] <Derick> it happens when a driver calls killcursors, but the cursors are no longer alive
[13:52:41] <the_german> Derick: That is so strange. My foreach iteration always stops between 70000 and 80000 documents. And that is the only thing I can find in the logs remotely related
[13:55:50] <symbol> Could be a memory thing?
[14:00:04] <the_german> symbol: This is happening on 2 machines. One has only 4GB RAM. The other 64GB. Was my first thought too
[14:00:14] <the_german> could it be something with the cursor. idk
[14:00:26] <symbol> Yeah, cursor timeouts will cause that.
[14:00:56] <symbol> This thread has useful information - https://groups.google.com/forum/#!topic/mongodb-user/Xas1n7opXKM
[14:04:59] <the_german> I found that thread too. I just don't know how on of my queries would stop for 10 minutes
[14:05:52] <the_german> How is that even possible when iterating over a whole collection. Some background tasks? but for 10 !! minutes?
[14:06:46] <symbol> Hmm
[14:07:07] <symbol> Any weirdnesss in data/db?
[14:08:50] <the_german> no. i important a lot of jsons with mongoimport. After that I "parse" all the data and put it into another collection (this is why I use find().forEach())
[14:09:19] <the_german> I just started the process again with timeouts disabled...maybe it helps but it really messes with my head
[14:09:21] <symbol> I wonder if you have a bad doc?
[14:09:48] <symbol> Gotta run, good luck!
[14:09:54] <the_german> ok cya
[14:13:04] <hamid> Hi guys, We happen to have this problem which sometimes our embedded documents thriplicate randomly without any will, and you can see lots of repeated IDs mostly. Has anyone ever encountered this issue before (on MongoDB 2.4) and do you know if it's a known bug?
[14:14:48] <pamp> @Derick So for a production server U recommend non LTS versions of OS?
[14:15:24] <pamp> We need to make a decision now, between LTS or newer versions
[14:23:57] <schu> hi. is there a way to "import" back mongodb's .0, .1 and .ns files? i have a broken server and only access to these files...
[14:24:28] <Derick> schu: you should be able to just put them in the right dir
[14:24:33] <Derick> make sure mongod isn't started when you do so
[14:24:37] <Derick> and then start it up
[14:24:51] <schu> Derick: thanks
[14:24:57] <Derick> pamp: it's tricky. Personally, i would pick the latest available version
[14:25:01] <Derick> schu: make a backup first :)
[14:25:26] <schu> derick: yeah, i certainly will :)
[14:29:01] <StephenLynx> pamp I suggest using a RHEL derivative.
[14:29:10] <StephenLynx> ubuntu and debian are not that great on servers
[14:29:33] <Derick> RHEL - running old software since 2000
[14:29:43] <StephenLynx> specially debian now they are more concerned about politics rather than technology
[14:29:57] <StephenLynx> and straight up lied about a repository being deprecated.
[14:30:08] <StephenLynx> to endorse people they had more sympathy for.
[14:30:26] <StephenLynx> but hey
[14:30:29] <StephenLynx> its your server.
[14:31:17] <cheeser> gentoo++
[14:31:18] <cheeser> :D
[14:37:19] <pamp> thanks U all
[14:37:43] <pamp> By now I will go to ubuntu LTS
[14:37:55] <pamp> with time I will check this better
[14:41:38] <StephenLynx> also, the better maintained repository is the RPM one.
[15:22:25] <terabyte> if you have a document as {someId:1, items:[{sublist:[{},{},{}]}]. You can always "get, update client side, post new document", is there a neat way to target the updating of elements in a that neatly?
[15:23:39] <morenoh149> hello all
[15:39:06] <sousvide> hi there. any ideas on why my brand new mongodb 3.0 install is completely ignoring the /etc/mongod.conf file?
[15:39:38] <sousvide> using ubuntu 14.04.3, base install, nothing else, made edits to conf file for dbpath and logpath but "sudo service mongod start" will not refer to, read, or respect the conf file
[15:40:41] <sousvide> to test, i also edited /etc/init/mongod.conf to point to my new db and log paths, same issue - running service start fails silently
[16:06:05] <morenoh149> how does mongoimport work with arrays?
[16:06:24] <morenoh149> I want to populate a document that has an array field, but I'm using csv
[16:12:38] <cheeser> does csv even support arrays?
[16:13:59] <morenoh149> it does not. After researching it looks like the only viable solution is to have a post import step.
[16:14:08] <morenoh149> http://stackoverflow.com/questions/31212691/how-to-import-specific-csv-values-as-array-in-mongodb
[16:19:38] <Steve-W> Hi all. I'm encountering a problem using the sample code for the ruby driver, failing with "NoMethodError: undefined method `convert_key'" in Mongo::Options::Redacted. Others seem to have this issue, but I can't find any solutions online. Might I get a little help please?
[16:29:35] <morenoh149> you use upserts to ensure you don't insert the same data more than once right?
[16:54:43] <morenoh149> what do I do at the end of a forEach to update the current document?
[16:55:04] <morenoh149> I'm afraid db.collection.save(e) would insert the modified document again
[18:13:29] <terabyte> if you have a document as {someId:1, items:[{sublist:[{},{},{}]}]. You can always "get, update client side, post new document", is there a neat way to target the updating of individual sublist items? a sort of "update sublist where /json/path/to/sublist/id=1 set /path/to/sublist/field->1 for someId->1
[18:14:15] <terabyte> (see how it's not just an array, it's the array in an object which itself is part of an array)
[19:11:03] <morenoh149> does anyone know how to get mongo to use stringIDs like how meteor expects in a collection?
[19:11:25] <morenoh149> can I just set a setting on the collection and the database will choose the right ID type for new inserts?
[19:29:47] <morenoh149> how can I perform an update to a document that changes it's _id?
[19:30:02] <morenoh149> I'm inside a foreach and have access to a specific document
[19:46:21] <fullstack> Hello, how do I do ... findOne({someDateColumn:{$ne : { $type : 9 }}}) -- give me all rows where someDateColumn isn't type 9 -- BSON type 9 is Date
[19:46:57] <fullstack> is it $not instead of $ne?
[19:54:48] <fullstack> Where can I get https://docs.mongodb.org/manual/reference/operator/query/type/ Available Types as a structure
[20:00:43] <fullstack> I need BSON types numbers from Mongodb Client driver 2.0
[20:00:46] <fullstack> but its not in the API
[20:00:50] <fullstack> and I can't find BSON();
[20:01:01] <fullstack> morenoh149, yes it should
[20:23:51] <morenoh149> anyway to check if an array contains a value from a script?
[20:24:18] <morenoh149> if (p.Purveyor2 && !p.purveyors[p.Purveyor2]) {
[20:24:20] <morenoh149> p.purveyors.push(p.Purveyor2)
[20:24:22] <morenoh149> };
[20:24:42] <morenoh149> p.purveyors is an array, I need to push into only if it does not contain a certain string
[20:24:53] <Derick> use addToSet ?
[20:26:15] <morenoh149> :( but I'm in a forEach callback
[20:26:37] <morenoh149> db.products.find().forEach(function(p) {}..
[20:27:41] <morenoh149> and we don't get underscore api in mongo right?
[20:27:58] <Derick> I've no idea what that means
[20:28:11] <morenoh149> that's a no
[20:28:25] <morenoh149> _.contains for membership in a collection
[20:33:12] <morenoh149> we may have Array.some
[20:36:00] <morenoh149> yes we do :)
[20:36:16] <morenoh149> if (p.Purveyor3 && !p.purveyors.some(function(e) { return e === p.Purveyor3 })) { p.purveyors.push(p.Purveyor3) };
[20:52:04] <dufabricio> hi..
[20:54:51] <dufabricio> ok.. nick registered lol. . So. .could any help me.. I have the follow document schema { _id : "23123123", name: "John" , monitoredUsers: [ { foo1: true } , { foo2: true } ] }
[20:55:39] <dufabricio> I want to update foo2: for "true".. how is the elegant way for it.
[20:55:49] <dufabricio> SHould i use $push ?
[20:56:42] <morenoh149> $set is good
[20:56:49] <dufabricio> Considering that i have user name "foo2" like a param for query.
[20:56:51] <dufabricio> hum..
[20:56:52] <dufabricio> ok..
[20:57:07] <dufabricio> thanks @Morenoh149
[20:57:20] <Derick> you should not store a value as a key
[20:57:42] <Derick> monitoredUsers: [ { user: 'foo1', monitored: true } ,
[20:57:50] <Derick> then just use update with $