PMXBOT Log file Viewer

Help | Karma | Search:

#mongodb logs for Sunday the 14th of October, 2012

(Back to #mongodb overview) (Back to channel listing) (Animate logs)
[00:00:03] <_m> *linux administration
[00:00:16] <_cmplrz> _m: you can't just say that
[00:00:20] <_m> There was a more articulate answer. However, I gave up halfway through.
[00:01:22] <_m> See Bilge's comment above.
[00:06:14] <_cmplrz> this is very childish guys, why are you her. To help peopled or to pretend being funny and bully around. If it' the late then you need to find a better way of using your saturday nights
[00:10:18] <cjhanks> cmplrz, I missed the question, want to restate?
[00:12:02] <cmplrz> cjhanks: thank you sir. I appreciate your offer
[00:35:54] <tomshreds> Hi, I'm trying to get all things that has been published on a certain date. How can I do this?
[00:36:14] <tomshreds> db.things.find({ publishedDate: "2012-10-13 11:11:11" }) ?
[00:36:56] <cjhanks> Unless you are looking for a specific datetime, you will want to search for a date range.
[00:37:44] <tomshreds> Ok alright, let's say from javascript, can I use a JS date object? or a date as a string?
[00:37:59] <cjhanks> Javascript Date objects work.
[00:38:13] <tomshreds> nice
[00:39:21] <tomshreds> thanks
[00:55:41] <tomshreds> cjhanks: does date ranges work the same? like { publishedDate: { $gte: new Date('2012-10-01'), $lt: new Date('2012-10-10') } } ?
[00:59:43] <cjhanks> tomshreds: { "publishedDate" : { "$gte" : Date }, "publishedDate" : { "$lt" : OtherDate} }
[00:59:55] <cjhanks> I put it as two find requirements.
[01:00:46] <tomshreds> oh nice thx
[01:16:44] <iamzaki> hi guys
[01:17:22] <iamzaki> anybody here?
[01:20:44] <iamzaki> I need to use MongoDB tomorrow to do some search queries, I have no programming experience, where should I start?
[01:39:26] <thiagorramos> Hey, guys
[01:41:48] <thiagorramos> I am creating a little site using MongoDB, and I`d like some advice about the collections
[01:42:44] <thiagorramos> I need for some pages a list of cities divided by state
[01:43:09] <thiagorramos> But it seems a little weird to me to create a lot of documents with just a list of cities of that state
[01:43:32] <thiagorramos> what`s a good practice in that case?
[02:04:39] <airportyh> Hello all, I have the following query
[02:04:40] <airportyh> http://pastie.org/5055154
[02:05:04] <airportyh> for which I got the result of { "result" : [ { "_id" : null, "total" : 1 } ], "ok" : 1 }
[02:05:38] <airportyh> it seems like $group's _id cannot be a nested field, otherwise it gets ignored
[02:05:50] <airportyh> is that true and is there a workaround to that?
[02:20:08] <dandv> Can anyone help with this question? http://stackoverflow.com/questions/12878662/what-exactly-is-the-difference-between-an-attribute-and-a-field-in-mongodb-t
[02:23:30] <airportyh> dandv: in a quick google search I am seeing attribute being used to mean fields in the database also
[02:23:54] <airportyh> I don't think there's a "standard" terminology
[02:24:02] <airportyh> attributes, fields, properties, whatever
[02:40:50] <dandv> but attributes != records, right?
[02:41:23] <dandv> I see this at http://auth-docs.meteor.com/#meteor_publish: "Name of the attribute set". I think they mean, "name of the record set"
[02:42:43] <airportyh> sure looks like a mistake
[02:44:34] <airportyh> dandv: in mongo terms records are actually called "documents" though, and "record sets" would probably correspond to "collections"
[02:44:50] <dandv> good points
[02:44:58] <airportyh> http://www.mongodb.org/display/DOCS/Mongo+Concepts+and+Terminology
[02:45:09] <dandv> meteor claims to be database-agnostic, so maybe that's why they use records
[02:45:14] <airportyh> yup
[02:45:28] <airportyh> sounds like a meteor terminology
[02:45:48] <airportyh> everything sort of muddles together though
[02:46:03] <airportyh> so many different technologies do similar things
[03:41:51] <cmplrz> is there a way to print the value of the search result and not the complete json
[03:41:57] <cmplrz> so instead of { "INTRFCE_NAME" : "inf000" }
[03:42:03] <cmplrz> inf000
[03:42:29] <cmplrz> i don't want to start parsing strings without checking if that's possible in mongodb first
[03:44:32] <LouisT> cmplrz: within the shell?
[03:44:40] <cmplrz> yes
[03:44:59] <cmplrz> i will eventually have to make a call to mongo from bash
[03:45:20] <cmplrz> so i need to get a value directly without awk/sed ...etc
[03:46:23] <LouisT> db.foo.find()._addSpecial("$returnKey" , true )
[03:46:33] <LouisT> oh wait, that's the index key
[03:47:34] <cmplrz> LouisT: i just learned this, I have one db with one collection and i need to extract a string. I managed to get to the row in the collection that I'm looking for using this
[03:47:35] <cmplrz> db.splnk_inf.find({"INTRFCE_ID":"0000" }, {"INTRFCE_NAME":true, _id:0 });
[03:47:49] <cmplrz> and it returns this:
[03:47:58] <cmplrz> { "INTRFCE_NAME" : "inf000" }
[03:48:35] <cmplrz> i only need inf000 at this point
[03:48:48] <LouisT> yes i get that, just a moment, looking into it
[03:48:59] <cmplrz> LouisT: thanks mate
[03:49:33] <ianblenke1> and .INTRFCE_NAME doesn't return inf000 ?
[03:49:33] <tomshreds> Hey guys, is there a way to do like with SQL "select * from things where ThingId IN (1, 2, 3);" ?
[03:49:37] <tomshreds> (the in part)
[03:49:40] <tomshreds> with dates
[03:51:41] <cmplrz> tomshreds: i don't think you can do IN with dates, I would try BETWEEN
[03:51:54] <LouisT> cmplrz: can you use map?
[03:52:04] <tomshreds> oh but I have separate dates, not range
[03:52:07] <cmplrz> but even BETWEEN is not ANSI standard
[03:52:17] <tomshreds> so how should I do this?
[03:52:19] <cmplrz> you may have to use it twice
[03:52:51] <cmplrz> BETEEN date1, date2 OR BETWEEN date3, date4
[03:53:07] <LouisT> cmplrz: something like: db.splnk_inf.find({"INTRFCE_ID":"0000" }, {"INTRFCE_NAME":true, _id:0 });.map(function(x) { return x['INTERFACE_NAME']; })
[03:53:10] <cmplrz> LouisT: what is map, im totally new to this
[03:53:12] <LouisT> er
[03:53:16] <LouisT> cmplrz: something like: db.splnk_inf.find({"INTRFCE_ID":"0000" }, {"INTRFCE_NAME":true, _id:0 }).map(function(x) { return x['INTERFACE_NAME']; })
[03:53:48] <cmplrz> LouisT: let me try that
[03:54:21] <tomshreds> omg
[03:56:15] <LouisT> cmplrz: uh, that wont work actually because i spelled the return wrong
[03:56:50] <cmplrz> LouisT: it prints [ "inf000" ] now
[03:57:23] <LouisT> db.splnk_inf.find({"INTRFCE_ID":"0000" }, {"INTRFCE_NAME":true, _id:0 }).map(function(x) { return x['INTRFCE_NAME'][0]; })
[03:57:26] <cmplrz> LouisT: better than before
[03:57:37] <LouisT> actually
[03:57:42] <LouisT> i don't think it'll return anything but an array
[03:57:46] <ianblenke1> var doc = db.splnk_inf.findOne(); doc.INTRFCE_NAME;
[03:58:11] <cmplrz> ianblenke1
[03:58:22] <LouisT> ianblenke1: oh.. yea that'd work as well >.>
[03:58:55] <cmplrz> Bilge: are you learning something
[04:03:13] <cmplrz> ianblenke1: i tried your method, replace findOne with my query and nothing came back
[04:03:23] <cmplrz> doc =db.splnk_inf.find({"INTRFCE_ID":"0000" }, {"INTRFCE_NAME":true, _id:0 });doc.INTRFCE_NAME;
[04:20:39] <LouisT> cmplrz: maybe just try: db.splnk_inf.find({"INTRFCE_ID":"0000" }, {"INTRFCE_NAME":true, _id:0 }).INTRFCE_NAME;
[04:22:56] <ianblenke1> yeah, I don't fully understand why that variables is needed for the findOne(). I think the find() is returning a cursor, where findOne() is returning the actual document.
[04:23:49] <LouisT> ianblenke1: i think that's how it works
[04:24:57] <ianblenke1> db.splnk_inf.find({"INTRFCE_ID":"0000" }, {"INTRFCE_NAME":true, _id:0 }).forEach( function(i) { print(i.INTRFCE_NAME); } );
[04:25:02] <ianblenke1> something like that.
[04:25:49] <ianblenke1> yep. that works.
[07:02:59] <nezZario> ok, never used mongodb (read some docs to see what it was about, far as I went) .. a friend of mine suggested I give it another shot, which I have no problem doing
[07:04:41] <nezZario> I have a fairly specific problem i need to solve, though ... To keep it generic say I have "manufactor" and "items" .. why I don't want to use a regular relational database with this, is I need to use "item templates" for each mfg
[07:06:42] <nezZario> for example ... mfg #1 might always be ship_from = 'US' for 9 out of 10 of their items .. i want to be able to specify, for any piece of data, instead of specifying a value, specify "pull from template [or parent, or /whatever/]" .. but, not just for blanks - or whatnot - i need to have a way to specify "no data" and "pull from parent" and it pull from a "template" for that mfg
[07:07:10] <nezZario> i cannot figure out a sane way to do that in mySQL, so seeking alternatives
[07:07:49] <nezZario> keep in mind, i must be able to search where ship_from = 'US' and it match even where ship_from is only defined in the template, and the item was told to pull from template
[07:08:29] <nezZario> i'm pretty sure i can do this with mongodb (and my data set doesn't fit column-based relational databases anyway) ... by just telling each document which ones are pulled from parent and "caching" those in the document itself
[07:08:46] <nezZario> but is there a more graceful way before I get head over heels in documentation? any specific place i should look first ?
[08:55:16] <brainopia> I recall there were a trick which allowed to start mongodb with database preloaded into filesystem cache
[08:55:30] <brainopia> but i don't remember exactly what should I do to achieve it
[08:57:54] <brainopia> On a server restart, copy datafiles to /dev/null to force reheating to be sequential and thus much faster.
[08:57:55] <brainopia> found it
[09:53:07] <Bartzy> Hello
[09:57:56] <ranman> hello
[12:16:05] <Bartzy> Is there a way to insert a document into one collection and update - in the same "Transaction" ?
[12:16:13] <Bartzy> I know there is no such concept in Mongo, but maybe in some other way ?
[12:17:10] <mids> insert a document and update what?
[12:18:34] <Bartzy> update another, sorry :p
[12:19:24] <ppetermann> Bartzy: no
[12:19:46] <Bartzy> no indirect way ?
[12:21:44] <mids> maybe you could put both pieces of information in the same document
[12:22:45] <mids> what is the context of your problem?
[12:59:43] <wereHamster> nezZario: do the templates ever change?
[13:00:07] <wereHamster> nezZario: in your example, does mfg#1 ship_from ever change to somethig else than US?
[14:24:22] <Bartzy> Hello!
[14:24:46] <Bartzy> I'm migrating data into MongoDB, and my "Schema" in Mongo uses ObjectId (_id) as a timestamp (so we won't need a timestamp key by itself).
[14:24:58] <Bartzy> I'm using PHP - how do I create a custom MongoId with a specified timestamp ?
[14:37:42] <Bartzy> Anyone ?
[14:38:17] <wereHamster> wow. You waited a whonle 13 minutes.
[14:43:06] <touillettes> hi everyone is there anybody who use the php driver for bulk insert here ?
[17:19:20] <tomshreds> Hey has anyone played with &lt and &gt with MongoDB with JavaScript? I'm having a hard time with dates and I'm doing exactly as told.
[17:29:53] <dob_> Hey tomshreds I am using it with nodejs
[17:30:44] <dob_> var query = offer.findOne({_id: offerid, lastdate: {'$gte': Date.now()}, availability: {'$gte': Date.now()}}, 'title duration docs firstdate lastdate applications max_applications');
[17:44:27] <tomshreds> Anyone? http://stackoverflow.com/questions/12884662/find-using-lt-and-gt-with-javascript-dates/12884689
[17:56:57] <dob_> this.find({ cardId: cardId, entryDate: { "$gte" : start, "$lte" : end } })
[17:57:10] <dob_> don't forget the "" :-)
[18:21:06] <_cmplrz> hi
[18:27:00] <dob_> tomshreds: Did that work for you?
[18:38:26] <dob_> How can i handle a field with multiple references? Should that be saved as array? How should i remove entries?
[19:37:47] <mantovan1> hi guys, I'm follow this http://docs.mongodb.org/manual/administration/sharding/
[19:37:54] <mantovan1> but when I try run mongos
[19:37:56] <mantovan1> I get an error
[19:38:22] <mantovan1> http://nopaste.info/0b5d53253b.html
[19:41:30] <mantovan1> and worked
[19:45:35] <wereHamster> dob_: google 'mongodb updating'
[19:46:39] <dob_> wereHamster: Thank you very much, but that does not help. Seems that nobody knows how to delete references in an array....
[19:52:14] <mantovan1> guys
[19:52:26] <mantovan1> mongos> use admin db
[19:52:29] <mantovan1> switched to db admin db
[19:52:32] <mantovan1> mongos> db.runCommand( { shardCollection: "myapp.users", key: {username: 1} } )
[19:52:33] <mantovan1> { "ok" : 0, "errmsg" : "access denied - use admin db" }
[19:52:45] <mantovan1> why ?
[19:53:48] <mantovan1> sh.shardCollection("myapp.users", {username: 1})
[19:53:49] <mantovan1> works
[19:59:45] <wereHamster> dob_: $pull
[19:59:52] <wereHamster> dob_: it's right there on the wiki page.
[20:00:39] <dob_> thank u!
[20:05:44] <wereHamster> You're welcome. And learn to read.
[20:21:29] <dob_> I have posts with embedded comments. Now i want to output all comments of the posts and paginate thorught them. So I would need something to inline limit and sort. Is something like that possible or is it better to create first class objects for comments?
[20:22:29] <mantovan1> guys I did a 500MB inserts in mongos
[20:22:33] <mantovan1> but when I do
[20:22:38] <mantovan1> show dbs
[20:22:43] <mantovan1> everything is with 0 bytes
[20:22:50] <mantovan1> but If I do du -h /data
[20:22:54] <mantovan1> is there
[20:23:40] <dob_> stupid question solved it in my map reduce function.
[20:24:57] <mantovan1> someone have some idea ?
[20:43:23] <mantovan1> heko
[20:43:27] <mantovan1> hey
[20:43:29] <mantovan1> ?
[21:30:24] <mantovan1> when I do some insert I get
[21:31:13] <mantovan1> mongos> db.data.insert({a:1})
[21:31:13] <mantovan1> can't create user databases on a --configsvr instance