[04:00:43] <speaker1234> I read up on indices and how to create them. My question now is how do you create an index when you first create a database? Maybe a better way to ask is how I guarantee indices when I re-create the database after dropping it?
[04:09:28] <speaker1234> I would think I'd want to only call it once when the database is just starting new to
[04:09:49] <cheeser> why? it's a no-op if the index already exists.
[04:10:43] <speaker1234> oh. That's interesting so every time I establish a connection to a database, I call ensure index. If it has records to create an index from, it will work automatically only once
[04:11:03] <speaker1234> work automatically I mean will create the database index automatically but do it only once
[05:22:53] <joannac> also next time please mention pymongo in the original question so I don't have to try and decipher ;)
[05:23:50] <Synt4x`> joannac: yea sorry about that I've only ever worked with Mongo in PyMongo so it slips my mind that there are other ways, I'll be more careful. Thank you
[05:47:30] <Synt4x`> anybody had this happen to them before?
[05:47:31] <Synt4x`> pymongo.errors.OperationFailure: database error: Runner error: Overflow sort stage buffered data usage of 33554623 bytes exceeds internal limit of 33554432 bytes
[05:48:21] <Synt4x`> nevermind ignore that i'll find some solutions online :)
[05:53:55] <Synt4x`> nevermind the answers online were pretty confusing to me, I'm only getting back 42,470 documents from my query that I'm trying to sort it seems kind of crazy that causes a memory overflow
[05:58:28] <joannac> 42k documents x 1k document size = 42MB. The limit is 32
[06:00:04] <Synt4x`> joannac: hrmmm, ok, is there an easy way to split it up into 2 queries? or perhaps another way to avoid that, I'm not sure what's best to do in this situation, first time happening to me
[06:00:07] <joannac> so you don't have to sort in memory
[06:02:16] <Synt4x`> joannac: hrmm and if it was indexed, say I went into each document and put an index in there, wouldn't I still need to use the .sort() function? If not it already has an object.date field (that I am trying to sort on), can I use that as the index?
[07:00:06] <gihejk> im dropping virtual apples A_i on earth's spherical surface and each one has a radius R_i and a center [lng, lat]. If there any built in way yet to be able to query for all the apples whos radii lie within R_0 of some center [x,y]?
[07:01:00] <gihejk> this is simple for a set of apples {A_i} such that R_i = R_j fr all i,j, but is more complicated when R_i =/= R_j for all i,j
[07:10:26] <gihejk> if i have an object X which has center (x,y) and radius R, if the polygon i specify intersects the circle, will that result come up?
[07:10:35] <gihejk> or does the center itself have to be in the polygon region
[07:10:56] <joannac> "Selects documents whose geospatial data intersects with a specified GeoJSON object; i.e. where the intersection of the data and the specified object is non-empty. This includes cases where the data and the specified object share an edge."
[07:11:09] <gihejk> so "geospatial data" refers to the entire circle?
[07:12:34] <gihejk> joannac (___._|__)___| so the object with center at that point other to the left will come up in the geoIntersect query of the rectangular polygon, correct?
[07:13:55] <joannac> Even an overlapping adge counts
[07:14:18] <gihejk> the docs will tell me how to create a circle ^^
[07:14:49] <gihejk> then i can develop variable radii circles
[07:15:01] <gihejk> and see which ones intersect with the polygon!
[07:17:06] <gihejk> yeah im not too orried about whether it's inclusive or not, the edge is such a small thing it wont make a huge difference in the app
[07:18:24] <gihejk> bye joannac thanks, again very much!
[07:20:11] <joannac> Jaevn: if you had asked your question you might have an answer by now ;)
[08:34:51] <fatdragon5> i’ve been hearing some conflicting stories but perhaps the experts here knows more :-) i have an enterprise app that will definitely require full ACID (multi-document transactions). I’ve heard that it will be addressed in the next major release after this upcoming one. But then from a different source I was told that it’s not on any roadmap…
[10:04:01] <dorongutman> if someone has any input on the following question that would be really helpful - https://groups.google.com/forum/#!topic/mongodb-user/LEnVxTmsWig
[10:21:16] <BurtyB> dorongutman, no idea here as I don't believe in AWS ;)
[10:22:17] <dorongutman> BurtyB: I have a fruitarian friend who doesn’t believe in hemoglobin
[14:28:02] <andrer> I'm having some issues with a replica set. Three servers and the PHP driver (tried both 1.5.8 and 1.6). The seed list matches the replicaset configuration.
[14:28:12] <andrer> And everything works as long as all three are up
[14:28:39] <andrer> But when one is turned off, PHP continues to connect without any hitches, but any query ran results in a MongoCursorTimeoutException
[14:28:53] <andrer> It does not seem like the driver chooses one of the two other servers at all.
[14:41:14] <lolcookie> why is no one maintaining mongoskin?
[15:07:02] <ldiamond> Is there text search in mongo that allows to return "similar" results (like with trigrams or levenshtein distance and such)?
[15:43:05] <pward123_> does rs.initiate() need to be called each time mongo is started?
[15:43:56] <ehershey_> no just to do initial configuration
[16:04:31] <mephju> Hey guys! I have a mongoose question. The situation is that I am saving a rather deeply nested document and validators are not applied to the deeply nested portion of the document. Why would this happen?
[16:06:01] <mrmccrac> confused why im seeing lock status for Global, Database, and Collection on a particular query when running 3.0.0rc6
[16:06:14] <mrmccrac> do you need to run wiredtiger to do collection-level locking?
[16:08:02] <mrmccrac> that makes me think this operation needs three write locks?
[16:24:09] <pward123_> ehershey: I'm using the stackbrew/mongo:2.4 container with --volumes-from and the collection data persists, but I have to run rs.initiate() each time I rm/run the mongo container
[16:28:34] <djlee> Just done a an upgrade on ubuntu, my mongo version as you can see from aptitude log was updated : "[UPGRADE] mongodb-10gen:amd64 2.4.9 -> 2.4.12". However when i tried to start mongo after the upgrade, i started getting this error: "ERROR: Encountered an unrecognized index spec: { v: 1, key: { location: "2dsphere" }, ns: "loop.cities", name: "location_2dsphere", 2dsphereIndexVersion: 2 }" ... should this have happened?
[16:28:34] <djlee> Why did it happen? Since when did a bug/hotfix upgrade introduce such a big change
[16:32:47] <StephenLynx> try using mongo repository instead of the default one.
[16:32:59] <StephenLynx> 2.4.x is quite outdated, we are o 2.6.7
[16:35:40] <djlee> StephenLynx: think im using 10gen. I will check that though as my local mongo is 2.6 but staging server is 2.4 (yeah i know, stupid). But im more weirded out how the old version before upgrade, managed to use a index version of 2, when a newer version post upgrade, couldn't boot with that same index
[16:36:22] <StephenLynx> your case must be the 3rd I saw this week with bugged indexes after upgrades from 2.4
[16:36:25] <djlee> StephenLynx: I do need to upgrade the server, so when i do, hopefully that database i had to disable will start working again. Just weird by whats happened
[16:37:44] <djlee> StephenLynx: Yeah but i upgraded from 2.4.9 to 2.4.12, if i'd have upgraded from 2.4 to 2.6 i'd understand something going wrong somewhere... If its just bad luck or no explanation thats fine. I just don't like not knowing why things have hapened... curiosity more so than anything else :P
[16:39:15] <dorongutman> if someone has any input on the following question that would be really helpful - https://groups.google.com/forum/#!topic/mongodb-user/LEnVxTmsWig
[16:49:21] <pward123_> was originally using 2.6 when I started having problems getting replica set working so I jumped back to 2.4
[16:50:00] <StephenLynx> "Accomplish in 10 lines what would otherwise take 1000, thanks to a reactive programming model that extends all the way from the database to the user's screen."
[16:51:21] <NoOutlet> I would think ranman might have some insight about AWS.
[16:57:24] <C4nC> Hello everybody, I need an advice for a mongo sharding replicated cluster.
[16:57:58] <C4nC> I try to figured out how can achive a ha cluster with 3 node
[16:58:38] <C4nC> it should be a sharding cluster (3 shard) and each replicated to the other nodes
[16:59:29] <C4nC> are there any good man that could help me clarify some aspect of the config?
[17:08:17] <pward123_> StephenLynx: official mongo docker container running 2.6.7 -- I can docker stop/run the mongo container all day, but if I docker rm/run my collections still have data but I get the following error from mongod
[17:08:21] <pward123_> [rsStart] replSet can't get local.system.replset config from self or any seed (EMPTYCONFIG)
[17:08:51] <pward123_> running the mongo shell against the container and executing rs.initiate() resolves the problem
[17:09:03] <pward123_> is there some file that's being modified by that command that's not in /data/db ?
[17:21:50] <ldiamond> Is there text search in mongo that allows to return "similar" results (like with trigrams or levenshtein distance and such)?
[17:22:58] <macbroadcast> hello all, i want to import initial data into a mongodb but given command " mongorestore -h localhost -d leanote --directoryperdb /home/user1/leanote/mongodb_backup/leanote_install_data/ " gives me an "Unexpected identifier" whats wrong with the command ?
[17:23:52] <mrmccrac> ldiamond: you'll probably need to supplement your mongo instance w/ elasticsearch or something for doing that kind of search i imagine
[17:25:57] <ldiamond> mrmccrac: I see, do you know if mongo integrates well with solr or elastic search?
[17:38:53] <gt3> when doing a range with $gt and $lt and limit 100, i have some _id's that are missing. So when I that, sometimes instead of getting 100 results back I get like 73. Is there a way to ensure I always get 100 back?
[17:42:05] <gt3> for example: User.find({'_id' : { "$gte" : 0, "$lt" : 100 } }).limit(100) # if any _id's fields are missing, i'll get less than 100 but I want it to skip those and keep going so I always get 100
[17:42:16] <StephenLynx> if you got 73 its because only 7
[19:38:42] <beardedhen> I'm trying to investigate why I have so much outbound traffic (using a local/private network for most traffic)
[19:39:10] <beardedhen> When running `netstat -t -u -c` I see a lot of
[19:39:11] <beardedhen> tcp 0 0 myserver.com:51885 myserver.com:27017 ESTABLISHED
[19:40:15] <beardedhen> It's a replicaset, but the slaves are all accessing private.myserver.com. Why is it trying to access itself externally rather than localhost?
[19:43:33] <pward123_> are there default locations where mongo stores config files?
[19:44:41] <pward123_> heh thanks. must not be fully awake yet. right after I pressed enter, I started a find/grep
[19:46:07] <styles> I have a document with comments. I have a comment have a "username" and "userid" (username for display purposes).
[19:46:16] <styles> if people change their username
[19:46:21] <styles> what's the best way to do this
[19:47:44] <pward123_> db.update({userid:"1234"},{$set:{username:"blah"}}) should do it I think
[19:49:04] <pward123_> anyone have an idea of where rs.initialize stores its changes?
[19:49:21] <StephenLynx> you either duplicate data and updates everything with said duplicate or you perform aditional queries to obtain the relational data.
[19:49:36] <StephenLynx> the solution pward provided is the best approach, imo.
[19:49:46] <StephenLynx> because people don't change usernames often.
[19:51:08] <Derick> pward123_: local database, in system.replset
[19:55:47] <pward123_> Derick: if I run mongo and issue a rs.initiate(), stop mongo, wipe the dbpath clean and start mongo I still get info about replSet can't get local...
[19:56:10] <pward123_> is there a location other than dbpath where the initiate makes changes?
[19:58:46] <pward123_> the real problem is that I'm running mongo in a docker container that gets removed every time its run and I need to persist all data in a data volume container
[19:59:11] <pward123_> currently, I'm only persisting the dbpath tree. however, I'm still having to run rs.initiate each time I start the container
[20:00:55] <jayjo> I've set up a signal on the initialization of documents, post_init, and put a testing print statement to see when it executes. Whenever I start a connection to my db, it initializes every document in my database. Is this typical behavior?
[20:19:04] <joannac> jayjo: what does "initialisation" mean?
[20:19:51] <joannac> pward123_: nope, all in dbpath. are you sure you're saving the whole thing?
[20:25:50] <pward123_> joannac: yep. just learned about "docker diff". looks like the container is modifying files in /var/db as well. will try adding that
[20:52:01] <FunnyLookinHat> If I'm running a database for an internal tool with fairly low-load ( i.e. a dozen writes every 10 seconds ) - is there still a good reason to have a primary and secondary server setup? i.e. I don't do that for the MySQL applications we rely on - and they do just as much ( if not more ) work.
[22:02:49] <ezakimak> in pymongo what's the diff between system.js and system_js ?
[22:03:38] <ezakimak> i recall vaguely that they aren't entirely interchangeable, but the docs leave it ambiguous
[22:26:53] <Skunkwaffle> I'd like to use mongo aggregation to find the total number of records that have a particular value, and divide them by the total number of documents that have another value. Here's what I'm doing now: http://pastie.org/9872417
[22:27:17] <gt3> anyone know why find({'_id' : { $gt : 0, $lt : 100 } }) would return 100 results fine from pymongo, but returns nothing directly in a mongo shell?
[22:28:33] <Skunkwaffle> This works fine for single events, but I'm not sure how to proceed if I want to use an array of values for each. Does anyone know how to match against an array in a $cond?
[22:28:39] <gt3> the field exists fine, and i get results if i type this directly in a mongo shell find({}, {'_id':1}).limit(3)
[22:30:19] <Skunkwaffle> gt3: are you sure you're using the correct database & collections? I've made that mistake before.
[22:31:29] <Skunkwaffle> Also check your datatypes. I'm not sure how pymongo interacts with mongo, but if your _id values are strings instead of ints, you might not be able to find them directly in the shell.
[22:32:44] <mrmccrac> connecting to a mongos vs. connecting directly to a shard?
[22:35:53] <Skunkwaffle> I'd be suspicious of the results from pymongo too then. They may be fine, but they may also be matched lexicographically, which is probably not what you want.
[22:37:26] <gt3> Yeah. I've been getting funky results, so was hoping the shell would tell me why, but that's probably why. Which is not good because i don't know how else I can chunk this into ranges if i can't use _id
[23:12:49] <djlee> Is there any way to downgrade a v2 2dsphere index on a mongo install that doesnt support them
[23:19:18] <gt3> I don't get mongo. I have string _id's like "1", "2", etc but doing db.userprofile.find({}, {_id:1}).sort({$natural:1}) shows them as 1, 2, etc except suddenly it goes from 574 to 1068 to 547
[23:19:53] <gt3> is there a better way to sort numbers that are strings?
[23:23:26] <djlee> gt3: since when were mongoid's incremental?
[23:23:32] <gt3> things work fine from pymongo at least. I can find the highest id with User.find_one(sort=[("_id", -1)])
[23:24:15] <gt3> djlee: shrug, my brain just wants to work one way and going back between a db layer and direct mongo client is confusing me
[23:24:54] <gt3> think i just need to stay in pymongo where i'm having consistency
[23:28:50] <sssilver> Hey guys, I have a nested document in the form of {"a": 1, "b": 2, "c": {"aa": 11, "bb": 22}} -- I need to only update bb's value. But if I pass update() a data = {"c": {"bb": 22}}, naturally that ditches "aa". What's the way to do this?