PMXBOT Log file Viewer

Help | Karma | Search:

#mongodb logs for Tuesday the 17th of February, 2015

(Back to #mongodb overview) (Back to channel listing) (Animate logs)
[00:11:16] <user23> How do I fix this startup error Permission denied: "/sys/dev/block/9:2/queue/read_ahead_kb", I've already given the file +rx permission
[00:18:45] <joannac> user23: did you check all the way up the tree?
[00:19:01] <joannac> also, what version?
[00:25:33] <user23> joannac: Yes, I checked all parent directories. Version 2.6.7
[00:29:48] <user23> Well it looks like "chmod -R +rx /sys/" worked...
[00:29:58] <joannac> right
[00:30:05] <joannac> you were missing a permission somewhere
[01:55:11] <kmtsun> quit
[02:43:41] <giowong> is anyone here familiar with monk?
[03:43:15] <morenoh149> anyone know how to do replicaset on a mac?
[03:43:20] <morenoh149> I keep getting "errmsg" : "couldn't initiate : need all members up to initiate, not ok : localhost:27017"
[03:43:36] <morenoh149> giowong: the tv show? ;)
[03:43:54] <giowong> morenoh149 no lol
[03:43:58] <giowong> i wish
[03:49:47] <joannac> morenoh149: um, is the mongod up on that port?
[03:50:10] <morenoh149> yes there are three mongod running on my machine
[03:50:29] <morenoh149> the lecturer mentioned he couldn't get it working quite right on osx
[03:51:32] <morenoh149> https://gist.github.com/8961cd51edfbe5f13808
[03:51:56] <joannac> the lecturer?
[03:52:37] <joannac> You know M101 has its own forum for questions about the course, right?
[03:53:11] <joannac> also, I want proof that all 3 mongods are running
[03:55:56] <giowong> but on a serious note anyone?
[04:32:34] <giowong> how do i return specific fields of acollection?
[04:32:58] <joannac> http://docs.mongodb.org/manual/tutorial/project-fields-from-query-results/
[04:40:40] <giowong> so
[04:40:43] <giowong> for some reason
[04:40:51] <giowong> only the find() query works
[04:41:00] <giowong> but when i try to only return specific fields it desont?
[04:41:24] <joannac> pastebin please
[04:45:37] <giowong> http://pastebin.com/cV5LHC6k
[04:47:21] <joannac> giowong: erm, that proves basically nothing
[04:47:32] <joannac> show me the find() query without any projection
[04:47:43] <joannac> then the find() with a projection
[04:48:18] <giowong> http://pastebin.com/jpTSqKRS
[04:48:25] <giowong> with projection it just returns nothing
[04:48:27] <giowong> blank
[04:48:42] <giowong> or it just throws some error
[04:48:46] <joannac> that's because you don't have a type field
[04:49:11] <giowong> every colllection must have a type field?
[04:49:15] <joannac> no
[04:49:26] <joannac> but you're querying for documents that have type: 'Object'
[04:49:33] <joannac> and none of those documents have a type field
[04:49:41] <joannac> so... surprise surprise, no results
[04:49:42] <giowong> correct yeah i was just trying some stuff out
[04:50:13] <giowong> but i tried db.usercollection.find({email: 0, password: 1, _id: 0}) and mongo console returned nothing
[04:50:36] <joannac> that's because you have no documents matching email: 1
[04:50:43] <joannac> the first argument is the match part
[04:50:50] <joannac> the second argument is the projection part
[04:51:46] <giowong> arguement of the find method?
[04:51:52] <joannac> yes
[04:52:08] <joannac> http://docs.mongodb.org/manual/reference/method/db.collection.find/
[04:53:16] <giowong> http://pastebin.com/ExB8yQce
[04:54:00] <joannac> get rid of the email : 0 part
[04:55:00] <giowong> thank you
[05:02:10] <NoOutlet> To explain the message "mix of inclusion and exclusion", when you project with {field: 0}, mongodb will return the documents without 'field', everything else included by default. When you use {field: 1}, mongodb will return documents with only 'field', everything else excluded by default (with the exception of _id).
[05:06:17] <giowong> ahh makes sense
[05:35:12] <morenoh149> those forums are lame
[05:35:56] <morenoh149> ps aux | grep mongo returns several lines at different ports. Its an osx thing I'm sure
[05:37:19] <joannac> morenoh149: pastebin the output
[05:38:55] <morenoh149> https://gist.github.com/975c6d1ba8b24bed2250
[05:39:30] <NoOutlet> 27017 isn't part of the replSet.
[05:39:42] <joannac> what NoOutlet said
[05:40:49] <morenoh149> added the shell script I ran. Why didn't that create a master?
[05:41:15] <joannac> when you ran it, did you get any errors?
[05:41:27] <NoOutlet> Because you didn't kill the mongod that was already running.
[05:41:51] <NoOutlet> Notice the process ids.
[05:42:08] <morenoh149> no they all forked successfully
[05:42:10] <NoOutlet> 67205, 15348, 67208
[05:42:19] <NoOutlet> One of these things is not like the others.
[05:42:25] <joannac> morenoh149: check the file 1.log
[05:43:04] <NoOutlet> kill 15348
[05:43:20] <NoOutlet> Then rerun the mongod line that has "1.log"
[05:43:30] <morenoh149> ah yes I see address already in use error in 1.log
[05:49:03] <morenoh149> I'm seeing this when I try to run the first command again http://pastebin.com/1i7bQ4Um
[05:49:29] <joannac> seeing it where? in the logs?
[05:49:36] <joannac> which is "the first command"
[05:50:00] <morenoh149> in 1.log
[05:50:20] <morenoh149> after running mongod --replSet m101 --logpath "1.log" --dbpath /data/rs1 --port 27017 --oplogSize 64 --fork --smallfiles
[05:50:23] <joannac> yes
[05:50:27] <joannac> you don't have a config
[05:50:36] <joannac> so mongod is saying "I don't have a config"
[05:51:06] <joannac> initiate yuor replica set and the message will stop (because you'll then have a config)
[05:51:50] <morenoh149> anyway to init from a shell script or do I have to use the mongoshell?
[05:52:27] <NoOutlet> I'm curious as to the reason behind that question.
[05:52:29] <joannac> you have the use the mongo shell
[05:52:45] <joannac> or you have to invoke the mongo shell from inside a shell script
[05:52:57] <morenoh149> the instructor distributed a .sh file. I'll do it the mongoshell
[05:52:59] <NoOutlet> Why do you want to do it outside of the shell?
[05:53:44] <joannac> NoOutlet: automated deployments blah blah
[05:56:35] <NoOutlet> I'm a bit confused by some statements made here. Who is the instructor?
[05:57:57] <NoOutlet> Because it looks to me like you're just doing Homework 6.5 in m101 and I could be wrong but I would guess you're doing the Node.js course based on your other gists.
[05:58:43] <morenoh149> yes I am.
[05:59:01] <morenoh149> also this is the coolest thing I've seen all month https://github.com/BYVoid/Batsh
[05:59:05] <morenoh149> offtopic
[05:59:44] <NoOutlet> I'm currently in that class (already took m101p, but was hoping to learn some Node.js and didn't realize how similar the class was going to be) and there isn't a .sh file. There are some boxes with the commands you have to enter in the shell.
[06:01:30] <joannac> NoOutlet: thanks for the tip
[06:01:49] <joannac> morenoh149: you can ask for help with homework after the due date. Until then, do your own homework
[06:05:57] <NoOutlet> This isn't on topic of mongodb at all, but I'm just coming across these 14 Black Paintings by Goya. He painted these things on the walls of his own house and I'm having trouble looking at Saturn Devouring His Son. Cannot imagine that being on the wall.
[06:14:16] <morenoh149> nah. If someone offers to walk me through the parts I get stuck on I'll take the help
[06:26:43] <flusive> Hi, I have big problem with mongo config server and logs, I used quiet option but my log file still increase :( inside is only a lot of writes like CMD fsync: sync:1 lock:0, its the problem because this file takes few GB's space in 24 hours
[06:27:31] <joannac> what else is in the log file?
[06:28:03] <flusive> nothing
[06:28:12] <flusive> only a lot of this CMD fsync: sync:1 lock:0
[06:29:23] <flusive> http://pastie.org/9955647
[06:33:46] <joannac> flusive: what version?
[06:34:20] <flusive> 2.6.5
[06:36:16] <joannac> looks like https://jira.mongodb.org/browse/SERVER-16638
[06:38:51] <flusive> yes but problem is still open :(
[06:43:34] <joannac> flusive: are you able to log to syslog and use rsyslog to filter, as per the comment on the SERVER ticket?
[06:45:13] <flusive> if its only one possible solution probably i have to do
[07:04:26] <flusive> joannac, i have one more question how can i check how many space weight my mondo data on each shard and how many space is free?
[07:04:45] <joannac> db.stats()
[07:07:09] <flusive> i think its not real information
[07:08:18] <flusive> joannac, i see fileSize 120GB when my /var/lib/mongodb = 80GB
[07:08:20] <Boomtime> flusive: are you suggesting that db.stats() returns something other than real information? could you describe what you mean?
[07:08:59] <Boomtime> flusive: can you print your db.stats() here?
[07:09:03] <Boomtime> (or gist etc)
[07:09:08] <flusive> ok
[07:10:10] <joannac> also du -hs /var/lib/mongodb
[07:10:19] <flusive> http://pastie.org/9955754
[07:11:07] <Boomtime> -> "fileSize" : 85791342592
[07:11:21] <flusive> Boomtime, its depend on shard
[07:12:09] <joannac> flusive: I need the output of 'du -hs /var/lib/mongodb' on each shard
[07:12:41] <Boomtime> flusive: are you saying that a particular shard is misreporting?
[07:13:00] <flusive> 81GB shard2, shard1 130GB
[07:13:15] <flusive> shard3 162GB
[07:13:26] <flusive> but I still don't know how many space I have free
[07:13:34] <joannac> that seems to line up with your db.stats()
[07:14:22] <joannac> flusive: type df
[07:14:42] <joannac> How much disk space you have free is not really a mongodb issue, it's a system issue
[07:15:14] <joannac> the command 'df' will show you how much space is used on whatever filesystems you have
[07:15:25] <flusive> joannac, i know that
[07:15:55] <flusive> but if i set shard max size to 150GB
[07:16:14] <flusive> and my /var/lib/mongodb on that shard is 162GB something is wrong i think
[07:16:29] <joannac> no
[07:16:36] <joannac> http://docs.mongodb.org/manual/tutorial/configure-sharded-cluster-balancer/#change-the-maximum-storage-size-for-a-given-shard
[07:16:43] <flusive> i have only one database on this shard
[07:17:09] <joannac> "The maxSize field in the shards collection in the config database sets the maximum size for a shard, **allowing you to control whether the balancer will migrate chunks to a shard.**"
[07:17:47] <flusive> joannac, do you suggest me i write something to shard without balancer?
[07:18:01] <joannac> "...Also, the balancer will not move chunks off an overloaded shard. This must happen manually"
[07:18:07] <joannac> flusive: what? no
[07:18:34] <flusive> so why my /varlib/mongodb has 162GB when i set beginning 150GB max size?
[07:18:40] <flusive> what happen?
[07:19:14] <joannac> flusive: did you read what I just quoted from the docs
[07:19:29] <flusive> yes
[07:20:18] <flusive> ok joannac sory my mistake
[07:20:28] <flusive> i wrong understand it
[07:25:47] <flusive> but joannac size of /var/lib/mongodb its real data size?
[07:25:57] <flusive> or maybe the space which mongo alloocated
[07:27:47] <flusive> if its not allocated it means my database increase 100GB/month :(
[07:28:41] <joannac> yes, /var/lib/mongodb is all allocated space
[07:30:32] <flusive> so my real free space for data is storageSize-dataSize-indexSize?
[07:30:51] <flusive> ofcourse using only allocated space
[07:30:57] <joannac> So, you ahve this concept called "free space"
[07:31:06] <joannac> which is the incorrect way to think about it
[07:31:16] <flusive> why?
[07:31:31] <joannac> not all of that free space can be used. You might have fragmentation
[07:32:22] <flusive> :/ where can i read something about that? because I still don't know how can I found real free space for data
[07:32:48] <joannac> http://docs.mongodb.org/manual/faq/storage/#why-are-the-files-in-my-data-directory-larger-than-the-data-in-my-database
[07:34:15] <joannac> http://docs.mongodb.org/manual/core/storage/#power-of-2-sized-allocations
[08:17:20] <Sp4rKy> W 8
[08:59:26] <morenoh150> has anyone here fiddled with rethinkdb? how does it compare?
[09:01:15] <morenoh150> http://www.rethinkdb.com/docs/comparison-tables/
[12:07:59] <Tug> Performance-wise, how bad is it to update an indexed field value very frequently ?
[12:11:17] <kali> i'd say 3 on a scale of 10
[12:11:41] <kali> +/- 2
[12:12:45] <Zelest> and how much on a webscale from mysql to mongodb then? ;)
[12:12:51] <Tug> let's say I update this index on every document insert and I have hundreds of insert per seconds
[12:13:05] <Tug> will I notice any difference ?
[12:13:32] <Tug> Zelest, I know performance is a touchy subject
[12:13:44] <Tug> but I'm not trolling
[12:13:55] <Zelest> nah, i'm just making fun of the word "webscale" :)
[12:14:10] <Zelest> "on a scale from.." on a "webscale from X to mongodb" :D
[12:14:10] <Tug> ok :)
[12:14:28] <kali> you'll have to bench it. it will probably be measurable.
[12:14:54] <kali> that said, hundreds of insert are usualy manageable
[12:15:10] <kali> so i would not worry too much
[12:16:03] <kali> Tug: you already have an index on the _id, so the worst you can expect is to be twice as slow (but it should not be that bad)
[12:18:25] <Tug> kali, sure. It's a pain to bench this though
[12:21:14] <kali> ha ?
[12:31:47] <queretaro> Hi, are permissions also replicated from within a replicaset primary to the secondaries? That is, if I have authentication (plaintext user/password) enabled in the primary and add the secondaries as a part of the replicaset just using rs.add(), do I have to do anything else for the system to work?
[13:29:51] <izolate> I'm setting up a dedicated db server. do you guys strongly advise against a standalone server in favor of a replica set?
[13:30:44] <Sticky> depends on your usecase and how reliable you want it to be and how valuble the data is
[15:31:19] <Neo9> http://pastebin.com/tL3kfzT1
[15:32:45] <NoOutlet> Would it be bad if it synced more often?
[15:34:23] <cheeser> maybe cron this daily? http://docs.mongodb.org/manual/reference/method/db.cloneCollection/
[15:37:59] <NoOutlet> I think it would be a lighter weight operation to do something like tailing the oplog more regularly than once a day.
[15:38:29] <cheeser> sure. but you'd have to process the oplog entries manually.
[15:39:26] <cheeser> or maybe this might help: http://docs.mongodb.org/manual/reference/program/mongooplog/
[15:41:46] <NoOutlet> That's not the understanding I have from this video: https://www.youtube.com/watch?v=lGcruDWeWA8#t=325
[15:42:45] <NoOutlet> I'm not sure of the exact operations that were used to create the tailable cursor Adam is talking about there, but I didn't get a sense of having to manually process the oplog.
[15:42:54] <cheeser> that's for feeding info in to solr. you'd still need to translate the entries to tell solr what to do with them.
[15:42:56] <NoOutlet> Maybe he was talking about the operation you linked to.
[15:43:01] <NoOutlet> Ah.
[15:43:08] <NoOutlet> Right.
[15:44:26] <guest9999> hello. how would i go about adding a new column to a sub document (in an array) of every matching root document? e.g. http://pastebin.com/eBbMbBZG
[16:06:33] <pamp> hi eople
[16:06:39] <pamp> *people xD
[16:07:53] <pamp> I need help with a problem I have at hand
[16:09:09] <pamp> ?????????????????????????????????????'
[16:09:14] <pamp> please
[16:10:19] <kali> this is not how irc works. just state your question.
[16:11:34] <pamp> ok thanks, but i'm new at this
[16:11:35] <pamp> :D
[16:12:24] <pamp> anyone knows how to unset an array, whos in a subdocument, and set him at the root of the document?
[17:03:06] <trial> hello all !!
[17:03:32] <GothAlice> Allo, allo, trial.
[17:04:21] <trial> I stuck with saving a child Schema in mongodb using mongoose
[17:04:47] <trial> unable to sort out what I am doing wrong
[17:06:00] <trial> This is an object i am trying to save http://pastebin.com/rVavB7mb
[17:07:05] <trial> and following is my schema http://pastebin.com/2LHsyJ2n
[17:07:34] <trial> when i am doing this -
[17:07:44] <trial> Order(order).save(function(err, result){
[17:07:45] <trial> if(err)
[17:07:47] <trial> throw err;
[17:07:48] <trial> console.log(result);
[17:07:50] <trial> });
[17:08:08] <trial> items are saving like this -
[17:08:12] <GothAlice> trial: First, there's nothing semantically wrong with your desired object. There are several points of concern, however. Indentation is confusingly inconsistent, having split address lines is rarely required (since your string can simply include a newline to separate as many lines as needed), and having inconsistent keys under items (length1/length2) will lead to madness. Also don't paste code into the channel!
[17:08:12] <trial> "items" : [
[17:08:13] <trial> {
[17:08:15] <trial> "_id" : ObjectId("54e36e18c59700b513a5309d")
[17:08:15] <GothAlice> Stop
[17:08:16] <trial> },
[17:08:18] <trial> {
[17:08:19] <trial> "_id" : ObjectId("54e36e18c59700b513a5309c")
[17:08:21] <trial> }
[17:08:22] <trial> ],
[17:08:24] <trial> okkk
[17:08:26] <trial> sorry
[17:09:20] <GothAlice> It'll be a moment before I can see messages from you again, trial. (Automatic flood limiting.) :/
[17:10:49] <trial> can you please explain me what I am doing wrong here @GothAlice
[17:10:52] <GothAlice> Right-o, should be good to go again. ^_^ Okay, yeah, your schema doesn't describe your document there.
[17:11:00] <GothAlice> itemSchema defines length, width, height, weight.
[17:11:06] <GothAlice> Not length1, width1, height1…
[17:13:50] <GothAlice> trial: Why do you have numbers in your document's field names?
[17:14:01] <trial> oh Girl......u saved me today...thx
[17:14:11] <trial> thx a lot Alice
[17:14:18] <GothAlice> ^_^
[17:14:29] <GothAlice> It never hurts to help. :)
[17:14:53] <trial> :)
[17:16:12] <saml> yo still no join right?
[17:16:22] <GothAlice> saml: I don't understand the question.
[17:16:22] <saml> this thing comes up in every meeting
[18:38:44] <MacWinner> finally made the decision to migrate everything over to MongoDb + Gridfs.. all data in mysql as well as all files stored in gluster
[18:39:01] <MacWinner> should I be waiting for 3.0 release?
[18:39:52] <MacWinner> or is upgrade from 2.6.7 to 3.x supposed to be fairly smooth? Not a huge dataset as of now.. maybe a couple millions documents
[18:39:57] <GothAlice> MacWinner: Do you absolutely require anything it would provide?
[18:40:23] <MacWinner> GothAlice, The storage savings looks interesting since a lot of our documents have repetitive data in it
[18:40:49] <GothAlice> Migration with re-compression (basically switching storage engines) is not a minor thing.
[18:42:33] <GothAlice> I implemented compression of low-hanging fruit (bulk text data like HTML fragments) application-side two years ago, since I couldn't wait for compression to be added upstream. (Same for full text search, also implemented it prior to it getting added upstream and better handles multilingual searches.) With an appropriate ORM/ODM rolling it yourself isn't difficult at all.
[18:42:48] <GothAlice> (And would give you a broader selection of compression schemes which could be tailored on a per-field basis…)
[18:42:54] <MacWinner> k.. I'm leaning towards just going with 2.6.7 as the baseline now and worrying about those features later..
[18:43:09] <MacWinner> GothAlice, which language/ODM are you using?
[18:43:13] <GothAlice> MongoEngine
[18:43:17] <GothAlice> (Python)
[18:44:10] <GothAlice> https://github.com/marrow/cache and https://github.com/marrow/task are some high-level tools built on top of that ODM we've open-sourced from work. :) (Task is WIP pending a bug fix MongoDB-side.)
[18:44:33] <MacWinner> we are kinda stuck on PHP for the time being
[18:44:48] <MacWinner> but thanks for all the tips.
[18:45:39] <MacWinner> as a first step, I'm going to be converting my existing replica-set to a sharded cluster.. we have a 2 member replica set plus an arbiter
[18:45:59] <GothAlice> Choice of sharding key is, well, key. ;)
[18:46:49] <MacWinner> GothAlice, yeah! i think I got some good pointers on that
[18:47:59] <GothAlice> MacWinner: https://gist.github.com/amcgregor/c33da0d76350f7018875 is a handy little shell script I wrote to assist in testing sharding keys locally (for automated testing rigs). This script sets up a 3x2 sharded replica set with authentication on one physical host (i.e. your dev box). Variables at the top to configure. :)
[18:48:25] <MacWinner> GothAlice, holy crap.. that's awesome! thank you!
[18:48:43] <GothAlice> My day is complete if I can save someone time. Anything worth doing once is worth automating! :D
[18:51:52] <foo2> Anyone here know how to do full text search using mongoose?
[18:52:14] <foo2> I am trying to understand this error:
[18:52:16] <foo2> "planner returned error: failed to use text index to satisfy $text query (if text index is compound, are equality predicates given for all prefix fields?)] name: 'MongoError' }"
[18:55:50] <GothAlice> foo2: Could you pastebin/gist the exact query you are attempting to run, an example document, and your index?
[19:00:03] <foo2> GothAlice: https://dpaste.de/4iWg
[19:00:24] <foo2> and I am just doing "Message.find({ $text : { $search : 'hello' } });"
[19:04:12] <GothAlice> foo2: Your error relates to http://docs.mongodb.org/manual/core/index-text/#text-index-and-sort (see bullet point two under "Compound Index")
[19:05:28] <GothAlice> foo2: What is the result of db.Message.getIndexKeys()?
[19:05:48] <GothAlice> (In the mongo shell, where "Message" should be replaced with whatever the actual name of the collection is.)
[19:09:51] <foo2> GothAlice: I haven't mongo-ed in a long time so I am bit rusty with the shell stuff
[19:10:14] <foo2> Basically, there is an existign app with that Message document and I am trying to add full text search to it
[19:11:46] <foo2> what's the besy way to go about it?
[19:15:01] <GothAlice> Well, a full text index is pretty useful for that. But the issue I think we're seeing is that {} objects in JS might not be preserving the definition order. (So the $text index is actually coming later in the index's field list than it should be.)
[19:15:43] <GothAlice> To determine if this is the case I need the output of db.message.getIndexKeys() from the shell. (The shell isn't actually that scary… you just need to connect and run that one line a la: mongo mydb)
[19:25:46] <foo2> GothAlice: Yeah, i am just reading the commands now
[19:26:50] <MacWinner> GothAlice, pretty awesome script you created to test out sharding! does it self-contain all the data and configuration into the directories specified in BASE, RUN, and LOG variables?
[19:27:03] <GothAlice> MacWinner: It certainly does. :)
[19:27:30] <GothAlice> (And if you nuke the contents of BASE, it'll re-create the local cluster from scratch.)
[19:28:01] <MacWinner> works like a charm
[19:28:13] <MacWinner> just saved me a whole day or 2 I think!
[19:28:17] <GothAlice> :)
[19:28:29] <GothAlice> It's also very useful for automated test suites.
[19:30:06] <MacWinner> GothAlice, at teh end of the script, it says this: "Remember to run db.runCommand({enablesharding: 'somedb'}) against your db of choice." not sure why it's not automatic?
[19:30:26] <GothAlice> Because the script doesn't assume which database you would like to shard.
[19:30:39] <MacWinner> oh.. got it
[19:30:44] <MacWinner> duh
[19:32:02] <GothAlice> And sometimes you want to test slightly different load scenarios. I.e. shard, then bulk load, or bulk load, then shard and rebalance, to see the performance implications.
[19:33:07] <cheeser> 1
[19:35:45] <foo2> GothAlice: I am getting ERROR: dbpath (/data/db) does not exist.
[19:35:57] <sang> hi i'm looking for some help. when i create a document via postman, i'm returned an { ok: 1 }. Is there any way to get back the entire document I just created?
[19:36:08] <foo2> but the data has to be somewhere, cause the app is loading it fine
[19:37:01] <MacWinner> GothAlice, is the admin user/password only for the admin database?
[19:37:29] <foo2> Is there any way to find out what data folder it is using?
[19:39:03] <foo2> got it - in mongodb.conf
[19:42:10] <foo2> GothAlice: https://dpaste.de/dhev
[19:42:21] <foo2> This is the index keys currently
[19:42:27] <foo2> without adding the text index stuff
[19:44:06] <GothAlice> Hmm. Give me just a moment to play in my own mongo shell to see what's expected here.
[19:45:41] <foo2> thanks :)
[19:45:52] <GothAlice> Right, yeah.
[19:46:11] <foo2> I am trying to add a search message history feature
[19:46:16] <GothAlice> So you can see in your mongo shell output the index on lines 13 through 19? That's the full text index you're creating.
[19:46:49] <GothAlice> (It is indexing room, posted, _id, and _fts = full text search.)
[19:48:14] <GothAlice> foo2: See how _fts (and _ftsx, together) are at the very end of that index. That isn't what you asked it to create, those need to be at the top. For whatever reason your JavaScript runtime isn't preserving the order of the object properties when you're creating that index spec. Is there an alternate syntax using array notation you could use to ensure the order is correct?
[19:49:23] <foo2> GothAlice: The output I pasted was after I reverted the code to remove any index on "text" attribute
[19:49:55] <GothAlice> Well, it's still there. It didn't delete the index.
[19:50:05] <foo2> I see
[19:50:11] <foo2> hmm
[19:54:28] <foo2> GothAlice: I am not sure how to do that, but thanks for providing the direction
[19:54:35] <GothAlice> foo2: https://gist.github.com/amcgregor/d5a90090f6cf6754cf95 < creating the index in the mongo shell does preserve order correctly.
[19:56:04] <foo2> GothAlice: I copy pasted that in the shell
[19:56:13] <foo2> but it didn't preserve the order
[19:56:19] <foo2> I got back what I had earlier
[19:56:28] <GothAlice> Weeeeird.
[19:58:11] <foo2> GothAlice: Is it because the index was already defined earlier?
[19:58:16] <foo2> how to remove all indexes
[19:58:53] <GothAlice> db.foo.dropIndex or db.foo.dropIndexes
[19:59:26] <foo2> oh wait
[19:59:28] <foo2> my bad
[19:59:31] <foo2> I was using db.foo
[19:59:39] <foo2> mine should be db.messages
[19:59:40] <foo2> ha
[19:59:48] <foo2> ok, the order is preserved indeed
[20:01:06] <GothAlice> XP
[20:01:25] <foo2> now to find out how to do that with mongoose
[20:03:20] <d0x> Hi, someone knows when aggregations over multiple collections will come?
[20:04:58] <cheeser> i don't know of any plans for that.
[20:05:31] <d0x> hm, o
[20:05:32] <d0x> k
[20:05:47] <foo2> GothAlice: how does adding an index affect the existing data?
[20:07:08] <cheeser> if it's a unique index and dropDrups == true...
[20:08:34] <foo2> cheeser: a text search index
[20:08:41] <cheeser> ah
[20:13:02] <GothAlice> d0x: The typical approach with MongoDB is to "denormalize" your data so that you wouldn't need the effect of a JOIN. Sometimes this gives the impression of data duplication, but practicality beats purity. MongoDB encourages you to design your data structures around how you're actually _using_ that data.
[20:13:32] <fxmulder> if I am seeing this when migrating shard chunks: errmsg: "E11000 duplicate key error index: mail.message_data.$message_identifier_1_chunk_1 dup key: { : "41178dad47a9bfab05fd4fb3c339f3a6.9d7408770af8e2bd107f..."
[20:13:44] <GothAlice> foo2: Creating indexes can block access to the collection (if background==false) or take a really, really long time (background==true) to initially build.
[20:13:52] <foo2> GothAlice: I removed indexes and now ran my program again and now it works :/
[20:14:08] <fxmulder> I would assume where should be a document in the destination replica set that would have a message_identifier starting with 41178dad47a9bfab05fd4fb3c339f3a6.9d7408770af8e2bd107f right?
[20:14:24] <foo2> Now it searches stuff. But I found a weird thing
[20:14:37] <foo2> GothAlice: It doesn't search the query 'this'
[20:14:46] <foo2> it returns 0 results
[20:14:55] <foo2> even those I have text containing that term
[20:14:58] <GothAlice> foo2: Well, the order may be pseudo-random. In Python (the language I have the most experience with) dictionaries ({} objects) store their keys in ID order, which for strings is the memory location the string is stored at. This can change on each execution of a script.
[20:14:59] <foo2> for all other term it seems to work fine
[20:18:36] <d0x> GothAlice: Yeah, seems like i don't get around "prejoining" the data. I had a look to apache spark sql (this Hive relacement) but with this i need to "copy" the data into their system (if i understood it correct)
[20:18:51] <d0x> And i dont like to setup a 2nd infrastrcutre
[20:18:58] <d0x> And i need response times from <200ms
[20:20:34] <GothAlice> d0x: Heh, part of the reason I use MongoDB instead of Redis/Membase. And MongoDB instead of ZeroMQ/RabbitMQ. And MongoDB instead of Syslog. And MongoDB instead of some external bulk file storage system like S3. And so forth. ;)
[20:21:28] <d0x> I need to find some arguments that Single Source of truth isn't that important when comes to our usecase
[20:21:57] <d0x> our production stores data in a single collections but our dashboard needs some joins
[20:23:44] <GothAlice> On one project I replaced Membase (cache; MongoDB provides TTL indexes), ZeroMQ/RabbitMQ (one has persistence, one is "faster"; MongoDB has tailing cursors on capped collections), Postgres (actual data storage), Celery (distributed tasks; replaced with 180 lines of Python and capped collections), and Boto (S3; MongoDB offers GridFS).
[20:24:38] <d0x> Junky :). I only replaced RabbitMQ by MongoDB
[20:26:50] <d0x> But this aggregation limitation and single source of truth principle is really a problem for me. We had a SAP Hana sales man in our house and he mentioned that the maintanence of this ETL scripts and stuff you don't have with hana.
[20:27:09] <d0x> But he haven't mentioned the prices for infrastrucutre as well...
[20:27:13] <GothAlice> http://www.devsmash.com/blog/mongodb-ad-hoc-analytics-aggregation-framework may prove useful.
[20:27:51] <GothAlice> d0x: Heh, with one of my datasets using a "popular cloud hosted MongoDB service" would cost me a half million dollars per month.
[20:28:43] <d0x> yeah, their prices per GB is strange. At the beginning is thought we have a design fault
[20:28:54] <d0x> because using their services would cost too much
[20:29:06] <d0x> and i thought we are using mongo for the wrong purpose :)
[20:29:18] <GothAlice> I have 26 TiB of data in my at-home DB. ¬_¬
[20:29:38] <d0x> lool :) I think even chuck norris can't do that!
[20:31:18] <GothAlice> I go to conferences and make dev teams for Dropbox, that "popular cloud hosted MongoDB service", and others uncomfortable at the parties. XD At one I even managed to kill bitbucket for 15 minutes by clicking the "Delete Repository" button. ¬_¬
[21:17:42] <liamkeily> if i have a collection of items. And for each item there is a reference to a user. Whats the best way to get the user for each item from a query. Is this bad structure?
[21:18:20] <GothAlice> liamkeily: A better question is what data about that user do you need in relation to each of those records? A name for display purposes?
[21:18:40] <liamkeily> exactly that GothAlice
[21:19:46] <GothAlice> liamkeily: There are several approaches, in order of complexity. Simplest (and least efficient) is to query the database for each of those names at your display layer, as you iterate the initial result set.
[21:20:15] <GothAlice> Better is to perform the first query, get your results, then issue a single additional query to get a mapping of user IDs to names for the whole set in one go.
[21:20:16] <liamkeily> i was thinking of querying for each one at a time. But then a cache layer would stop most queries.
[21:20:58] <GothAlice> I take the most complicated approach, which combines the first two approaches with caching.
[21:22:36] <GothAlice> My caching layer is MongoDB itself, but I'm caching more than just the user's name. I have a generic "render this key/value thing" function which, if the value is an ObjectId, will attempt to find a model with the same name as the key, load the record with that ID, then run str() across it, additionally wrapping it in an <a href=""> to the canonical URL for that record with an icon based on the type of record it is, then caches that.
[21:24:25] <GothAlice> A third approach, which I also use in some places (notably invoice documents) is to include the information you need in the records you have the "reference" in. I.e. {creator: {_id: ObjectId(…), name: "Bob Dole"}, …}
[21:25:48] <GothAlice> You just need to remember to, if the user changes their name, to run a db.invoices.update({'creator._id': user}, {$set: {'creator.name': newsman}}) to update the "cached" values.
[21:28:09] <liamkeily> GothAlice, thanks that helps a lot
[21:29:09] <GothAlice> The MongoEngine ODM has a schema type which can manage the synchronization for you: http://docs.mongoengine.org/apireference.html#mongoengine.fields.CachedReferenceField (FYI ;)
[21:29:42] <GothAlice> (And the syntax allows querying those cached values as if it were a join. Which is bad-ass.)
[23:13:01] <blizzow> I connected to my database/admin as the admin user. I did: use mynewdbname , then I did: db.createUser( { "user" : "auserwhoexistsonother", pwd: "myawesomepass", roles: [ "readWrite" ] } ) and get an error saying.
[23:13:02] <blizzow> Tue Feb 17 16:07:36.542 TypeError: Property 'createUser' of object metrics is not a function
[23:13:18] <blizzow> can someone explain to me what I'm doing wrong in creating a new user?
[23:15:34] <Boomtime> blizzow: can you type version()
[23:17:39] <blizzow> ahhh, my mongoshell is out of date. Thanks Boomtime.
[23:17:47] <Boomtime> :D
[23:23:18] <_blizzy_> so, in db.foo.find({:{'$gt',1}});
[23:23:27] <_blizzy_> $gt is basically a regex matching anything?
[23:23:47] <_blizzy_> wait nvm it's greaterthan.