PMXBOT Log file Viewer

Help | Karma | Search:

#mongodb logs for Sunday the 16th of September, 2012

(Back to #mongodb overview) (Back to channel listing) (Animate logs)
[00:02:03] <Vile> Is there local version of MMS, btw?
[00:02:12] <Vile> for inhouse installation
[05:15:39] <abstrax> hi, anyone on ?
[06:26:57] <wereHamster> abstrax: stupidest question on irc.
[06:45:13] <timeturner_> how do you model many to one relationships in mongo?
[07:07:30] <wereHamster> http://www.mongodb.org/display/DOCS/Schema+Design
[07:53:59] <abstrax> wereHamster: i was wondering whether people choose timestamps or simple date to store ?
[08:29:53] <wereHamster> abstrax: timestamps where
[09:10:54] <abstrax> wereHamster: against each record i want to store created_at
[09:18:53] <wereHamster> it's up to you
[09:19:47] <wereHamster> and you mean whether poeple chose an int64 or mongodb native date type..
[11:23:46] <SvenDowideit> argh! :)
[11:23:58] <SvenDowideit> I have some stored js that I'm trying to debug
[11:24:17] <SvenDowideit> and, that js is normally called from a $where clause in a query
[11:25:02] <SvenDowideit> I have added some print() statements to it, and when I call the stored js from the mongo shell, the code does what i expect, and prints the expected states into the mongodb.log file
[11:25:35] <SvenDowideit> but when its called from a query called by the perl app, nothing is printed to the log file, and the results are not as i expect
[11:25:40] <SvenDowideit> can anyone help me?
[11:26:13] <SvenDowideit> I _hope_ that there's something simple i can set to get the print() to go somewhere
[11:27:12] <SvenDowideit> i tried instead to insert the messages into a log collection, but that also only works from the shell for me
[12:34:39] <SvenDowideit> yup, Sun Sep 16 22:33:06 [conn28] query web_6e40bc35d8845d0bdbf7e2b803825b2e.current query: { orderby: { _topic: 1 }, query: { nolock: 1, _history: { $exists: 0 }, $where: "print("didja");" } } ntoreturn:0 keyUpdates:0 locks(micros) r:238 nreturned:0 reslen:20 0ms
[12:34:52] <SvenDowideit> the print does nothing
[12:38:27] <SvenDowideit> oho.
[12:38:53] <SvenDowideit> so - if I remove nolock:1 from the query, suddenly print() _does_ print :(
[12:59:42] <SvenDowideit> oh gads.
[12:59:57] <SvenDowideit> it might be that the global lock going away is the root of my problem?
[13:00:38] <SvenDowideit> I basically faked a join by having a db.getSisterDB('other').collection.find() in the $where
[13:01:16] <SvenDowideit> and i've come back to do some work on it a year or 2? later and (just blindly) installed 2.2
[13:02:10] <SvenDowideit> (i'm not 100% sure where anything is atm tho :/
[13:29:02] <SvenDowideit> ok, just confirmed.
[13:29:32] <SvenDowideit> yes, using $where : 'db.getSisterDB("ad").collection.find({})'
[13:29:47] <SvenDowideit> works in mongodb2.0, and is broken (by design i presume) in 2.2
[13:44:24] <fotoflo> hi All, i am running macOS and just updated to version 2.2.0 with brew
[13:44:43] <fotoflo> however my db.verison() still returns 2.0.6
[13:45:08] <fotoflo> whats going on?
[13:53:01] <ron> did you... restart?
[13:56:22] <Aartsie> Derick: yt ?
[14:14:22] <fotoflo> ron: i believe so… but maybe i just killed the client
[14:15:43] <fotoflo> yes, i just killed the client
[14:15:50] <fotoflo> thanks ron… now to find the default install directory
[14:21:12] <fotoflo> ok working!! now one more question: i have a collection with an array of tags in the schema, how do i use aggregate to get the list of unique tags?
[14:25:45] <fotoflo> > db.collection.aggregate( {$project: {tags : 1} }, {$unwind: "$tags"} )
[14:25:52] <fotoflo> close, but still have overlapping
[15:29:26] <timeturner> what is the most appropriate way to model a one to many relationship in mongodb?
[15:30:01] <timeturner> The only ways that I know if that all of the "many" documents have a field that references the "one" document via object id or something
[15:30:19] <timeturner> or the "one" document has a array of objectids that reference the "many objects"
[15:30:36] <timeturner> the problem with option 2 is that it isn't infinite in scale
[15:30:58] <timeturner> I don't know after how many objectIds will the max size of the document be reached
[15:37:32] <ron> timeturner: well, it's a bit more complicated than that.
[15:37:57] <ron> you should model your data based on your queries and not what 'feels' right.
[15:38:37] <ron> also, the document size limitation isn't really that big of a problem, and if you really fear of hitting the limits, there are various ways to deal with it.
[16:08:09] <timeturner> ron: so should I put the many objects' objectids in the one document as an array and if it exceeds that then adjust the system to become more decentralized to where each of the many docs reference the one doc?
[16:08:29] <timeturner> the many and the one are in different collections
[16:20:18] <ron> timeturner: I'd love to go into it with you, but I gotta run. maybe we could talk about it in a few hours.
[16:21:46] <Vile> timeturner: if there going to be huge number of documents and you are going to use small subset of them tied to the main document => use first type of connection
[16:22:28] <Vile> if you would need to have access to all of them (and don't expect many) at any time => store them as array
[16:38:30] <timeturner> ah
[16:38:40] <timeturner> yeah I plan to get the latest X posts by timestamp on the many docs
[16:38:48] <timeturner> so option one would be best I suppose
[16:39:23] <timeturner> At one point I was thinking about a hybrid approach in which I store the latest 10 docs in an array in the one doc
[16:39:28] <timeturner> and then query for the rest if needed
[16:39:34] <timeturner> via option 1
[16:47:22] <Vile> timeturner: could be good option if that would be often used option
[16:48:46] <timeturner> but the problem is that either I have to set a limit on the number of characters per document or I have to guess a hard limit so that those 10 docs don't exceed the main doc's size lmit
[16:48:48] <timeturner> limit*'
[16:49:37] <mrpro> when are you guys going to start adding new features instead of fixing same bugs/regressions over and over
[16:49:52] <timeturner> I was also thinking about calculating the difference between how much a particular document will take in the one doc via BSONSize and then check how much space is left in the one doc
[16:51:41] <Vile> timeturner: just add references as ID's, not the whole documents
[16:52:00] <Vile> and maybe some additional info
[16:52:27] <mrpro> eh dont use dbRef its a waste of time
[16:52:32] <mrpro> most useless feature ever
[16:52:55] <Vile> this way you will not have to care of what to do with sub-doc that goes out of the limit
[16:55:08] <Vile> depends on your usage scenario, though. But usually you would not want to have the whole sub-doc, only the part of it that makes sense and allows to easily get it from the main storage collection
[17:37:33] <bingomanatee> hi there
[17:37:44] <bingomanatee> does mongo support multi-field uniqueness constraints?
[18:35:06] <Neptu> yuhu
[18:35:09] <Neptu> ;)
[18:43:47] <wereHamster> bingomanatee: yes
[18:43:59] <wereHamster> bingomanatee: also, try it and see
[18:44:09] <bingomanatee> thx
[19:57:24] <noordung> Anyone here a user of Mongoose?
[19:57:49] <wereHamster> noordung: ask your actual question.
[19:58:26] <noordung> Right, I'm having some weird trouble. I open a connection, I try to save a document, and nothing happens... Never had this before...
[19:58:55] <wereHamster> pastebin your code
[19:58:55] <noordung> It has always worked for me, but I'm really puzzled...
[19:59:42] <noordung> This is the test code I'm running... http://pastebin.com/bVCWFDUe
[20:00:06] <wereHamster> and the output?
[20:00:37] <noordung> { test: 'OK', _id: 50562eea18ebf8a76b000001 } what is going on... Yay!
[20:01:03] <noordung> need I mention that the script doesn't exit ...
[20:01:29] <wereHamster> because the connection is open
[20:01:44] <wereHamster> btw, I open the connection with mongoose.open(url), not createConnection()
[20:01:51] <wereHamster> no idea if that makes a difference...
[20:01:56] <noordung> let's see
[20:04:47] <noordung> http://mongoosejs.com/docs/api.html#index_Mongoose-createConnection
[20:05:25] <wereHamster> sorry, I use mongoose.connect(url)
[20:05:27] <noordung> I'm really puzzled...
[20:06:12] <wereHamster> have you tried with mongoose.connect('mongodb://localhost:27017/test') ?
[20:07:21] <noordung> brb sorry
[20:34:01] <kaushik_> hi
[21:03:46] <taf2> when upsetting on a sharded cluster… if my shard key is aid and _id
[21:04:03] <taf2> is it enough to upsert on aid and another key? or do i need both aid and _id?
[21:10:02] <driscoll> quick q about interpreting mongostat output. not sure what the "locked db" is measuring exactly.
[21:10:55] <driscoll> i'm currently importing some very large JSON files... and locked db is reporting "collection:900%" and higher. this seems odd but my inserts are still around 4k/s
[21:11:22] <driscoll> any insight (or suggested reading) much appreciated!
[21:19:05] <noordung> brb = an hour :(
[21:21:31] <noordung> Anyhow, my Mongoose problem seems to be in calling mongoose.model vs connection.model... :/
[21:21:33] <chovy> how do i tell what version of mongodb i have?
[21:26:29] <noordung> Right, so note this: mongoose.model(modelName, modelSchema); only stores it in the mongoose implementation, you need to call connection.model(modelName) to get the model constructor...
[21:33:29] <driscoll> chovy: try $ mongod --version
[21:36:23] <chovy> k
[21:36:54] <chovy> that's the one problem with debian. everything is outdated.
[22:36:38] <driscoll> for the sake of the log: here's a bug report regarding the "locked db" question i posted earlier: https://jira.mongodb.org/browse/SERVER-6507
[22:57:41] <voldial> Anyone familiar with #ask in semantic-mediawiki? Basically you can embed typed var's in mediawiki pages, and also embed queries (like return all pages that have a GPS coordinate, or sum some var across a subset of pages) that generate a view of the results (table, number, graph, map whatever). It's cool, but it's this big PHP app... and the functions are somewhat limited... I want to roll my own replacement (not in PHP, not tied to media
[22:57:42] <voldial> wiki) and expose a lower level of access to the data... my first thought was to just let users enter SQL directly, but that cant be made safe... so I am looking at mongo's query language... is there some general solution that lets users submit mongo queries in a safe (read-only) way?
[23:07:16] <voldial> as far as I can tell, mogodb queries are read-only... but I suspect a user could still dos the system
[23:09:01] <voldial> found http://docs.mongodb.org/manual/faq/developers/#how-does-mongodb-address-sql-or-query-injection
[23:31:59] <timeturner> how do you do full text search in mongo?
[23:32:08] <timeturner> does it work by querying the index with every word
[23:32:24] <timeturner> or do I query for all the docs in the index
[23:32:50] <timeturner> and then just use client side js to display a sub amount of that?
[23:37:03] <vsmatck> timeturner: Search mongodb.org for "full text search" and click first result.