[07:12:11] <himanshu> Hi, I am new to mongodb. I have saved Object IDs as string without reference, at places where I want to tag. I did it in wrong way. Now I want to convert those string to object ID and reference them to respective Collections. Please help me out.
[07:15:42] <joannac> get the document, modify the document to make the string into a ObjectID, save the new document
[07:17:14] <himanshu> joannac: I see, I can convert these strings to object ids. But then how to add reference back to them ?
[07:20:40] <joannac> himanshu: what do you mean, reference?
[07:24:32] <himanshu> joannac: For example, a list of user id : [ user1_objectID, user2_objectID ]. So now I want to reference these user IDs to User Collection. Isn't this thing called referencing ?
[07:24:57] <himanshu> Correct me :P. I am new to mongodb.
[07:25:07] <joannac> I think you're thinking of something that doesn't exist
[09:52:30] <hdkiller_> hello! i have a collection with 8000 small documents and i am trying to do around 400-500 qps with queries like this: db.getCollection('pool_ip').find({ $and:[{ long_start:{$lte:3111560450}, long_end:{$gt:3111560450} }]}) and when i start mongodb host start loading. I have an index long_start_1_long_end_1 { "long_start" : 1.0, "long_end" : 1.0 }
[09:52:40] <hdkiller_> I am a mongo noob, what am I doing wrong?
[09:55:23] <hdkiller_> the load on the host running mongodb jumps to load average: 190.85, 67.92, 72.44
[09:55:59] <Derick> what does iostat tell you? what's your memory usage vs swap? How much data do you have? There can be so many reasons... it's not a simple answer.
[09:57:40] <hdkiller_> this collection is just 8000 small documents, i have no idea how large the whole collection, but i don't think it's significant to cause any problems. ram 64G/59G used no swapping at all
[09:57:59] <Derick> then check the log, there must be a reason
[11:50:59] <crazyphil> if I have a sharded 2.6 setup, and I need to turn auth on (mongodb-cr specifically), do I need to set every mongod instance for --auth, or only my config servers, or everything?
[13:29:56] <StephenLynx> the logic is very simple: will this index impact performance in a positive manner and I got resources to keep it? then you use.
[13:52:00] <StephenLynx> then why wouldn't you be able to store a bson file?
[13:52:08] <Derick> but it's not for storing "BSON documents" that you would store in a collection, for that to work, you need to serialize to a string
[13:52:33] <StephenLynx> he never mentioned he wanted to handle it like an actual document.
[13:53:09] <Derick> Pinkamena_D: in any case, if your normal documents are that big, you probably should rethink your schema
[13:54:04] <Pinkamena_D> I dont need to handle it like a document (while it is stored), I just thought the serialization would reduce preformance slightly
[13:54:42] <StephenLynx> if you don't have to handle it unlike any other binary blob, then yes, you can use it.
[13:54:52] <Pinkamena_D> most documents are not that large, this piece I am working on would act as a cache in case we were not able to connect to the actual in-memory cache
[13:55:12] <Pinkamena_D> just basically needs to work temporarialy
[16:00:01] <bros> How are replica members handled over WAN?
[17:49:59] <bros> Did not find local voted for document at startup; NoMatchingDocument: Did not find replica set lastVote document in local.replset.election
[17:50:02] <bros> Did not find local replica set configuration document at startup; NoMatchingDocument: Did not find replica set configuration document in local.system.replset
[17:50:41] <bros> "waiting for connections on port 27017"
[17:51:52] <bros> 2016-09-14T13:41:30.791-0400 I REPL [ReplicationExecutor] Error in heartbeat request to 10.8.0.10:27017; ExceededTimeLimit: Operation timed out
[17:52:08] <bros> It's over a VPN. Do I need to unblock that port?
[17:54:33] <Derick> bros: all nodes of the set need to be able to talk to each other
[18:31:11] <Derick> I said that all nodes need to able to talk to eachother (through port 27017)
[18:33:04] <pihpah> I have to insert about of 700 nested documents and it takes about 2 minutes. With every insert the insert time is getting worse, and that's really sad.
[18:49:15] <AndrewYoung> What sort of indexes do you have set up?
[18:53:25] <AlmightyOatmeal> I'm running a seemingly expensive query, is there any way to determine exactly what it's doing? Also, is there a way to make mongod utilize multiple processors? I'm currently running a query against a collection within a DB but it seems to be sticking to only one core :(
[18:55:08] <synthmeat> hey, is there some kind of mini mongo i could run? i like mongo, and i'd like to have it on really small instance (512MB) with possibly other stuff alongside it
[18:56:37] <synthmeat> hah. there actually is mini mongo, but that's something from meteor for clients. prolly single rw
[18:58:23] <synthmeat> totally another db with exact same surface (query language, i guess) would do too
[19:02:33] <pihpah> AndrewYoung: no indices at all.
[19:04:26] <AndrewYoung> AlmightyOatmeal: You can use the query analyzer. From the mongo shell you can run "var explain = db.foo.explain()" and then do things like "explain.find({ /* query */})"
[19:04:49] <AlmightyOatmeal> AndrewYoung: oh, that's sexy! thank you :)
[19:05:28] <AndrewYoung> The best way to make mongo use more than one processor for a single query is to implement micro-sharding, where you split your data across multiple mongod instances.
[19:05:46] <bros> AndrewYoung: how common is that?
[19:05:51] <AndrewYoung> However, it's complicated and there can be serious problems with it if you machine isn't well provisioned.
[19:06:12] <AndrewYoung> It has some very specific use cases where it works well, but it's not generally used.
[19:06:40] <AndrewYoung> You would want to run the shards in some sort of container so that they are memory limited, etc.
[19:06:59] <AndrewYoung> By default mongod makes use of all the memory on the box (effectively).
[19:07:36] <AlmightyOatmeal> AndrewYoung: that's one complaint that i have is that i can't seem to limit resource utilization of mongod which has caused OOM issues
[19:07:48] <AndrewYoung> Then you make the query to a mongos and it does a scatter/gather operation on the shards, splitting the work up amongst the shards.
[19:07:50] <AlmightyOatmeal> even when i tell wiredtiger to only use X GB
[19:08:06] <AndrewYoung> Interesting. Have you submitted a support ticket on that?
[19:08:30] <AlmightyOatmeal> AndrewYoung: i have not done so yet.
[19:09:10] <AndrewYoung> MongoDB will give either 60% of available RAM on the box - 1GB (it looks in /proc to find that info, I believe) or 1GB, whichever is larger.
[19:12:47] <AndrewYoung> synthmeat: You might try running it with the MMAPv1 storage engine instead of WiredTiger. You'll lose the benefits of WiredTiger though.
[19:13:20] <AndrewYoung> Under provisioning can be a problem though. If your "working set" (the combination of indexes and commonly used data) doesn't fit in memory it can cause performance issues.
[19:13:53] <synthmeat> that's fine, i wouldn't use it for such cases anyways
[19:14:15] <synthmeat> but, iirc, mmapv1 still required ample memory?
[19:14:20] <AlmightyOatmeal> FWIW, i've played with a number of WiredTiger cache sizes and have tried to slowly decrease trying to prevent OOM. i tried limiting the sources granted to the process but that really upset mongod
[19:14:36] <AndrewYoung> AlmightyOatmeal: Interesting. How much cache do you have?
[19:16:20] <AlmightyOatmeal> AndrewYoung: provisioned WiredTiger cache, or what cache inparticular?
[19:19:04] <AndrewYoung> OOM killer is worse under WiredTiger than MMAPv1 because when the kernel is running low on memory under MMAPv1 it just flushes stuff back to disk because it knows it can do that, but with WiredTiger it has to move stuff to swap. If it can't do that then OOM killer will kick in.
[19:22:18] <zylo4747> if i'm going to create a hidden replica set member with priority 0, can i put those options in the config file or do i only define them when adding the member
[19:23:04] <AlmightyOatmeal> AndrewYoung: i'm not running Linux so OOM Killer isn't a problem, however limiting available resources outside of mongod gave me http://pastebin.com/QVnbQbKc and to answer the swap question: http://pastebin.com/xDE8HFb8 but i try to avoid the extra disk I/O for swapping if at all possible as i would rather save that for actual data I/O
[19:24:32] <AlmightyOatmeal> i really hate to say that CouchBase was pretty sweet in terms of clustering and resource limiting/kindness but MongoDB is easier, faster, and the filesystem footprint is the smallest of any document stores i've tested
[19:25:02] <AlmightyOatmeal> but it seems resource control and ease of clustering has a long way to go :(
[19:25:19] <AndrewYoung> Yeah, it generally works under the assumption that it has the whole box.
[19:26:25] <AlmightyOatmeal> even if it has the "whole box", that means it can choke off other essential system services as well which is not a good thing if you want to guarantee Y percent of Z resources for system management :(
[19:26:56] <AlmightyOatmeal> have you heard of Percona Server for MongoDB?
[19:27:47] <AndrewYoung> Well, I meant no other major services running on the box. That's why it assigns 60% to the cache.
[19:27:59] <AndrewYoung> I know of it, yes, but I don't know any details about it.
[19:28:23] <AndrewYoung> Have you tried running mongod in a bsd jail to limit resources?
[19:28:31] <AndrewYoung> (Since you're on FreeBSD)
[19:29:05] <AndrewYoung> zylo4747: You put it in the replica set config
[19:29:56] <AlmightyOatmeal> AndrewYoung: in a jail, no, but i created a custom login class for the mongodb user running mongod (which is where i received the OOM)
[19:30:14] <AndrewYoung> synthmeat: Yes, it still requires a good bit of memory, but because of how it works (using the system mmap calls) it plays nicer in small memory environments I think.