[03:27:00] <LoneSoldier728> how do i see how much space something takes in the db
[03:32:18] <joannac> SteveDC: Don't ask you ask; you'll get much better results if you ask your question outright
[03:32:38] <joannac> LoneSoldier728: That doesn't parse. How much space a single document takes? A collection?
[03:37:40] <SteveDC> I have installed mongodb on centos 6.4 from the 10gen and 10gen-server i start the service and it starts with no problem. I then attempt to connect to mongo trys to connect on 127.0.0.1:27017 returns with exception failed to connect. I have shut it down and removed the mongo.lock and done a repair then started mongo attempted to connect again and got the same error might anyone know why this
[04:28:15] <LoneSoldier728> this is what mongohq expects
[04:28:16] <flyankur> If I have ObjectId, Is it possible to fetch its document without knowing its collection ?
[04:28:46] <LoneSoldier728> I am trying mongodb://127.0.0.1:27017/musicDB
[04:29:27] <flyankur> Lets say If i have a "product" collection, which has a field reference to another collections - "store" & "category"( like foreign key ) - I am using node.js & native mongodb driver. While iterating If i have ObjectID("52710f953564d744923a2f64"), how do I fetch its document, without knowing to which collection it belongs ?
[04:29:41] <flyankur> Example - https://gist.github.com/flyankur/7244345
[09:30:21] <flyankur> NodeX: Please have a look at this example of 2 documents from related collections - https://gist.github.com/flyankur/7244345 , If while iterating through product, I want to get each ObjectID's details too - How should I do, as I don't know what collection to this ObjectID is from.
[09:32:43] <flyankur> Like, Django has an ORM for RDBMs, If I query product model, I can get product.store.name & the whole store model also , but in NoSql, I am getting product, product.store._id only, not the whole store document.
[09:33:07] <flyankur> NodeX: please help, Am i writing the schema for MongoDb wrong ?
[09:37:57] <joannac> What do you mean, you don't know what collection it's from?
[09:38:15] <joannac> Are you going to have more than one store collection?
[09:40:11] <joannac> You'll need to make another round-trip to retrieve those
[09:40:14] <flyankur> Instead of ObjectId("234234234234"), I want to display the name of may be make it clickable.
[09:41:06] <joannac> Make another query to the stores collection, by store_id
[09:41:12] <flyankur> I am ok with that, but unable to figure out. Tried brute force, looped over all collections & did findone. Have a feeling thats not the right ways.
[09:41:45] <joannac> why do you need to loop over all collections? it's a store_id
[09:42:15] <flyankur> How do I know, which collection ( store, category, etc ) I am quering for ?
[09:42:57] <flyankur> joannac: please bear with me, this is my 8th day with Mongodb & node
[09:43:03] <joannac> either code it in (preferred), or use DBrefs
[09:44:33] <flyankur> joannac: So, I am right then, with just the Bson ( which includes ObjectID ) while iterating through it, Either I have to store collection type along with it or use DBref ?
[09:44:54] <joannac> if you want to store collection names with it, you need a DBref
[09:45:35] <flyankur> In case of DBref, I dont need to hardcode in the code the to figure out collection ?
[09:46:21] <flyankur> This approach, if(key == "store_id") {mystore = db.store.find({"_id": value})} else if (key == "category_id") {...} - Does not look scalable in my case.
[09:47:31] <joannac> I guess, depends how many of these refs you have
[09:48:21] <flyankur> Imagine If I am creating PhpMyadmin Kind of a tool for MongoDb, I will need DBref.
[09:50:28] <joannac> The docs recommend against DBRef, if that sways you any
[09:50:30] <flyankur> joannac: I am building a generic Admin tool/ UI for MongoDb which provides form to edit any document, rather that just plan document Bson - which is not easy to edit / use for a non-tech content team
[09:51:37] <flyankur> joannac: yeah, I read that , I guess that is why there is no Admin tool for Mongodb which provides better/usable CRUD interface
[10:05:37] <NodeX> flyankur what are you trying to achieve
[10:08:03] <flyankur> NodeX: So, current challenge I am facing in a project is - I need to give UI to the content team who is using this app I am building on Node.js & Mongo ( PHPMYADMIN type ) - where the content team can just see records & when they want to edit it - it opens up in a more intuitive interface - a Form
[10:09:35] <flyankur> NodeX: I am using https://github.com/flyankur/mongo-express as my boilerplate, have been able to Edit doc UI to - http://easeyourshop.com:8082/db/eysapp/product/52710f953564d744923a3005
[10:13:12] <flyankur> currently the problem I was facing was, all the reference field are coming as ObjectID(52710f943564d744923a2f59),etc - which is again not human readable - So I want to replace that with its lets say - category.name or store.name - because I want to make it generic, I don't want to hardcode in Node.js app - like if(key == "store_id") {mystore = db.store.find({"_id": value})} else if (key == "category_id") {...}
[10:14:33] <NodeX> why don't you just store the collection name?
[10:15:45] <NodeX> and why are you relating categories instead of embedding them>
[10:17:37] <flyankur> Ok, so there is something called embedding too.. I did not knew that ( I am sorry, Its my 8th day with Mongodb ) - Looking into it quickly & will get back to you
[10:20:33] <flyankur> NodeX: as far as I read just now, are you suggesting I should not have multiple collections ( eg. category, sub-category ), rather just embedded.. I want to keep category, stores as seperate collection as well
[10:22:48] <flyankur> NodeX: On the similar note - how does Joins type data handling work then - for me to achieve that I will have to embed the whole document ?
[10:23:12] <NodeX> avoid joins as much as possible
[10:27:54] <flyankur> NodeX: you mean store/embedd as much data in one document - does not matter if its duplicated ?
[10:30:06] <flyankur> NodeX: so as to avoid joins ^
[10:31:46] <joannac> then your updates will be more work
[10:32:50] <NodeX> flyankur : the basic concept is this... if you can make your page load with 1 query this is optimal. However, there is administration which has to be done to pages / data but it's accessed less frequenctly
[10:33:18] <flyankur> NodeX: there are long list of cases where joins are very much required. Specially in an E-commerce app ( should I query - may be using Elasticsearch or something ), if so RDBMS has an advantage in e-commerce use-case , where I need to generate all sort of reports , apply filters
[10:33:39] <NodeX> for example. If you had a document with a users "country" - some people (lunatics) would probably relate that to another table/collection but lets be honest how often does the name of a country change
[10:34:26] <NodeX> Obviously there are edge cases where joins are needed and it's not avoidable.
[10:35:12] <chukaman> hi. i have a question. if i'm running on ubuntu 10.04.4 lts and i use the official 10gen "ubuntu-upstart" repo should i be weary about upgrading a cluster comprising of 2x mongos, 3x conf servers and 4x shard servers with a replica set spanned across all of those shard servers from mongodb version 2.0.7 to version 2.4.7?
[10:35:15] <NodeX> it really does depend what your end goal is for using mongodb and why you're using it
[10:35:17] <flyankur> NodeX: what if I want list of all countries , or country with maximum number of lunatics :)
[10:35:36] <NodeX> flyankur : I didn't say that you dont have a collection with the list in it ;)
[10:38:25] <flyankur> NodeX: what kind of use case(s) do you use mongodb in ?
[10:38:58] <NodeX> For me disks are cheap so data duplication is not an issue and I have been working with mongo for so long it's second nature to write code in a way that makes manegemtn easier
[10:39:40] <joannac> chukaman: you'll need to upgrade to 2.2, then 2.4. Take backups. Take downtime. Go to 2.4.6, there's a problem with config servers on 2.4.7 which is being fixed
[10:40:16] <NodeX> flyankur : almost anything you can think of. CMS, CRM, Job Board, Social Network, Dating sites
[10:40:48] <NodeX> I don't use relational databases at all except when I need to do a transaction that might need a rollback which is not often at all
[10:41:00] <chukaman> joannac: wow, thanks for that. i'm really glad that i asked :)
[10:41:14] <flyankur> NodeX: I have felt the breeze of less complexity too, I also use mongo with Django - and now there are not more migrations & what not :)
[10:41:49] <NodeX> I am finding that I can do things now that really are not possible with relational systems
[10:42:18] <flyankur> joannac, NodeX can I have your github username ?
[10:48:14] <NodeX> you mentioned ElsaticSearch for searching. Personaly we use solr, I find it a lot more mature as a project, nothing against elastic search though
[10:50:13] <flyankur> NodeX: I also use Both, Solr is definitely more mature ( I use it here - thefingo.com ), But in some particular usecases I figured elasticsearch might just be better.. still experimenting though
[10:50:25] <Derick> NodeX: sorry... still not done!
[10:51:15] <NodeX> It's ok Derick : I have found some more information
[10:51:33] <NodeX> good news, it's the mongodb installation, bad news, I don't have a clue how to fix it
[10:52:33] <joannac> WHat did you break, NodeX? ;)
[10:52:57] <NodeX> Installation of 2.4.6 now 2.4.7 is screwed
[10:53:13] <NodeX> unless i start it as the root user or fork it the thing wont start
[10:53:35] <NodeX> https://gist.github.com/anonymous/7247774 <---- that error
[10:54:04] <NodeX> and when it does start it causes some weird error with the PHP driver by giving out jibberish as the db host name or somehting
[10:54:26] <NodeX> yet I can connect via the shell fine and it ingests data (it's a slave) with no problems
[10:56:14] <NodeX> 3 other slaves on the same kernel work fine, this one doesn't. All installed in the exact same way too
[10:58:32] <Derick> NodeX: As a hunch - looks like issues with linking against boost - perhaps linked against an older version of the lib, or perhaps with the wrong header files
[10:58:44] <Derick> NodeX: but the driver still should not segfault on broken data
[10:59:33] <NodeX> any suggestions on fixing ? .. update boost maybe?
[11:01:12] <NodeX> I've googled the error and a few other people have had it. It seems it's something to do with the kernel
[11:01:28] <NodeX> no the other machines are fine, this is the weird thing. they all have the same kernel image on them too
[11:03:22] <Derick> k, burn the server and rebuild it :)
[11:03:44] <NodeX> I wish, it's my clients mail server too :/
[11:04:21] <NodeX> I even purged mongod today and apt'd a new 2.4.7 but it's the same
[11:39:56] <benjamin___> I have a dataset consisting of addresses and geojson Points. I'd like to be able to do a query to find addresses near a particular address. I've got as far as being able to specify coordinates to search near, but not a single query. In SQL I'd use a join; is this something I can achieve with a compound index?
[11:42:42] <NodeX> have you looked at the geo capabilities of mongodb?
[11:43:48] <Derick> benjamin___: you need to do two queries. The first to find the address that you want to search near, and the second one to do the near query that you've already described
[11:44:12] <benjamin___> NodeX, yes I have done that
[11:44:52] <benjamin___> OK Derick, thanks, I was just wondering if there was a specific way. I'll continue to do it in that way then, thank you for clearing this up
[12:38:03] <NodeX> no, it queries to target anyting you specify
[12:39:00] <amitprakash> NodeX, okay, and how do I specify a query to check that ObjectId to some gt datetime?
[12:39:46] <NodeX> you need an ObjectId that represents that date time
[12:42:01] <amitprakash> NodeX, one last clarification.. mongodump -d DB -q "{_id: {\$gt: <RelevantOidForDatetime>}}" will dump all collections in db after executing that query against each collection?
[12:45:32] <NodeX> For example you might have a backups collection. You create an OID now and insert it as a job, next time you can take that OID as a base
[12:45:45] <NodeX> when backup is done, add the next oid, rinse and repeat
[12:46:31] <NodeX> infact you would have to add the new OID before starting the export as you might have inserted data between the two that wont get backed up
[14:53:04] <NodeX> I would say store when the shop opens and when it closes
[14:53:24] <NodeX> then you will have succesfuly stored the shop' opening hours
[14:57:35] <dasmith91> Hi everyone, I'm getting started with Mongo and MongoEngine and was wondering if someone could advise me on how to structure data? (Still thinking like I'm using SQL)
[14:58:27] <dasmith91> I've got a setup like this: https://gist.github.com/dasmith91/b432f1440d24e690f9da
[14:59:05] <dasmith91> This crashes as User isn't defined on line 11, however switching the classes results in the script crashing as Post is then not defined.
[15:12:27] <rickogden> NodeX: yeah, I was thinking that, an opening and closing time for each day. Just wondered if there was a good way of storing it so I could write a query for shops open at a specific datetime?
[15:13:50] <cheeser> there isn't a raw time type, no. you'd still have a date component
[15:14:12] <cheeser> though you might be able to use aggregations to apply time functions to those dates.
[15:21:28] <eldub> I currently have a 3 node replicaset configured
[15:21:49] <eldub> when I do an rs.status() I noticed that my db1's name is it's IP address and the other 2 have their host name
[15:22:05] <eldub> How can I change the one from IP to host name, without breaking the replicaset.
[16:42:47] <acalbaza> real quick question... how does the client shell know about hosts in a cluster? if i test failover, it works as expected, but when i do the same thing in an application, it does not.
[16:43:16] <Derick> the shell, as well as all the drivers (providing you use the correct mode) will all detect failovers
[16:43:28] <Derick> it uses "ismaster" to figure out which other nodes there are
[16:44:18] <acalbaza> ok.. i'm working with spring-data + mongo so i need to understand how to configure this client.
[18:33:26] <adamobr> copydb will copy my indexes too ?
[19:07:13] <tkeith> I set up a replica set using hostnames instead of localhost, but I need localhost. It seems like the simplest solution would be to complete remove the replica set config from mongodb and create it again. I don't have any data I need. How can I completely reset mongodb? Can I just clear /var/lib/mongodb, or will that have bad side effects?
[19:08:36] <revoohc> How does mongodb deal with timezones? Is it safe to move replicate to a server running UTC when the current master is EST/EDT?
[19:43:57] <umi> I only pasted a snippet of my full query to show the relevant part. If I replace cat.type with a string like 'test', it works, but I don't get the data I want.
[19:47:23] <umi> How can I use a variable as the key in an update?
[19:52:05] <kali> what about: {$set:{cat["type"]: cat.mouse}
[20:39:29] <l0st0ne> I have an odd issue, wondering if anyone has some thoughts…. I have a couple thousand missing documents in a sharded/replicated db.collection. When I query a mongos instance using an indexed query (not using fields in the shard key) the documents are not returned. If I run the same query on one of the db instances I find the documents. Anyone seen anything like this? We are on 2.4.3
[20:44:21] <kali> l0st0ne: i have had one like these at some point. i was using a hash-base sharding, and one mongos had been forgotten in a 2.2.x version, so it was writing some documents on the wrong shard
[20:46:41] <l0st0ne> Kali: thanks, we are not using a hash-based shard key, but I was thinking that maybe it was left behind in chunk migration
[21:18:04] <eldub> well I'm in the init.d right now taking a look around
[21:18:24] <eldub> I'm sure there's somewhere to put the numactl --interleave=all
[21:18:44] <eldub> this seemed promising but is completely different than my init.d http://stackoverflow.com/questions/11161308/starting-mongodb-via-numactl-as-daemon
[22:08:42] <tystr> could having ulimit -n and -u set too low cause disk IO problems?