PMXBOT Log file Viewer

Help | Karma | Search:

#mongodb logs for Thursday the 1st of August, 2013

(Back to #mongodb overview) (Back to channel listing) (Animate logs)
[00:10:08] <satshabad> Hey, will I suffer a preformace loss if I make an index on a field that only some of my documents have?
[00:10:25] <satshabad> i.e. hald of the documents will have a time field, and half not
[00:10:36] <satshabad> if I ensureIndex on the time field what will happen?
[00:13:16] <joannac> satshabad: Depends on what you're doing, you may want a sparse index?
[00:13:23] <joannac> satshabad: Not sure what you are asking.
[00:15:08] <satshabad> hmmm sparse index seems to be what i'll need
[00:15:35] <satshabad> joannac: I mean that I will have 1 collection with 2 type of documents being inserted
[00:15:44] <satshabad> one of these will have a time field
[00:15:53] <satshabad> I want to index on time
[00:16:36] <joannac> Make sure you read the warning about sparse indexes
[00:16:41] <joannac> http://docs.mongodb.org/manual/core/indexes/#index-type-sparse
[00:17:00] <satshabad> hmm
[00:17:17] <satshabad> They just won't return the results that don't have that field right?
[00:17:37] <satshabad> Isnt that to be expected?
[02:13:44] <LoneSoldier728> hey
[02:13:53] <LoneSoldier728> anyone know how to properly pull something nested in an array
[02:42:46] <sharondio> LoneSoldier728: Define "pull"? You mean query or update?
[03:07:24] <a|3x> db.something.find({'something':{'$not':{'$in':['something']}}}); works while db.something.find({'$not':{'something':{'$in':['something']}}}); doesn't, any reason why?
[05:29:22] <LoneSoldier728> hey anyone on here?
[07:36:00] <solars> hey, when using replica sets, and a client has a pool of IPs, do they determine automatically which is the right node to write to?
[07:44:58] <abn> Is there an easy way to conver a list to a document?
[07:45:05] <abn> *convert
[07:46:21] <abn> I have a field that is { <field> : [v1, v2 ] } ... I want to convert it to { <field> : { v1 : date, v2: date} } .... any help would be appreciated
[07:47:31] <abn> i have gotten as far as > db.collection.find({ field : { $exists : true } }).forEach( function (x) { // do something like x.field = {} );
[07:48:29] <rspijker> abn: what are the v1, v2 in your example?
[07:48:35] <abn> strings
[07:48:37] <rspijker> so, where is the date coming from all of a sudden?
[07:48:48] <abn> oh its in x,date
[07:48:53] <abn> (x.date
[07:49:07] <abn> so the document contains a field called date
[07:49:48] <rspijker> ok, so you have a document x like this: { field : [v1,v2], date:someDate} ?
[07:49:59] <abn> yes
[07:50:23] <rspijker> and you want { field :{v1: someDate, v2:someDate} { ?
[07:50:33] <abn> yup
[07:51:38] <rspijker> hmmm, aggregation framework can probably do it...
[07:52:05] <abn> rspijker: can you point me to a doc/eg: ? pretty new to mongo
[07:52:41] <rspijker> https://www.google.nl/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&ved=0CC8QFjAA&url=http%3A%2F%2Fdocs.mongodb.org%2Fmanual%2Fcore%2Faggregation&ei=gxP6UY3aDIPSOailgJgB&usg=AFQjCNEGOr0ZRDVKfAyZ2ZqdKarMjdgVaw&sig2=GJVnR1Vmb33XgUhDcZVDlQ&bvm=bv.50165853,d.ZWU
[07:52:45] <rspijker> crap :P
[07:52:50] <rspijker> http://docs.mongodb.org/manual/core/aggregation/
[07:53:01] <abn> thanks, looking
[07:53:03] <rspijker> aggregation framework can do *loads* of stuff
[07:56:41] <rspijker> do you want to actually change the documents in the db btw? Or just get the info out?
[07:57:03] <abn> rspijker: i want to update the db
[07:57:23] <rspijker> ok
[07:57:52] <rspijker> then aggregation might not be the best way, actually
[07:58:38] <LoneSoldier728> anyone understand what is going on wrong here?
[07:58:55] <LoneSoldier728> http://pastebin.com/CEsZPmc5
[07:59:04] <LoneSoldier728> I do not get why users[x]
[07:59:11] <LoneSoldier728> shows up as undefined when being pushed to the array
[08:01:41] <abn> rspijker: think i need to do soemthing liek create a temp doc and loop over each v1, v2 then update the x.field
[08:01:59] <abn> rspijker: any ideas on how i might do that within a function?
[08:03:35] <[AD]Turbo> hi there
[08:04:02] <rspijker> abn: don't think it's easy (or maybe even possible) in the general case...
[08:06:55] <rspijker> the problem is in creating fields with names that are not predefined but are the value of some other field
[08:07:14] <rspijker> I'm not sure javascript (which is what is used in the mongo shell) can do that
[08:09:06] <LoneSoldier728> is my code wrong somewhere
[08:09:11] <LoneSoldier728> I think it is the second query
[08:09:34] <abn> rspijker: actually writign an inner function worked
[08:09:42] <abn> now i just need to create a document
[08:09:49] <rspijker> can you show me the code? :)
[08:09:58] <abn> yup
[08:49:00] <remonvv> \o
[08:49:06] <Zelest> o/
[08:49:39] <ron> -o-
[08:51:23] <remonvv> Zelest and ron <3
[08:58:26] <kali> /\o< kwak kwak
[09:00:02] <remonvv> Yeah. I don't like ducks.
[09:02:08] <Nodex> mooooo
[09:02:13] <Nodex> woof, meow
[09:37:43] <molavy> hi
[09:38:16] <molavy> i have problem convert bson to json using bson_util
[09:38:41] <molavy> it return error randomly TypeError: ObjectId('51f7dcee95113b7a48e974fe') is not JSON serializable
[09:42:10] <Diganta> Hi all
[09:43:13] <Diganta> I need a help in hadoop mapreduce with mongodb connection
[09:46:52] <molavy> no idea?
[09:59:47] <rspijker> molavy: you can convert it to string
[10:00:34] <rspijker> how depends on why you are doing exactly
[10:00:54] <remonvv> molavy: You need to convert "ObjectId("x")" in your JSON to "{$oid:"x"}"
[10:01:34] <remonvv> Where x is the ObjectId value. You may have to quote the $oid part as well depending on how you're using it
[10:07:32] <Diganta> Hi remonvv
[10:09:42] <dob_> mongorestore error: boost::filesystem::file_size: Operation not permitted
[10:09:44] <dob_> any ideas?
[10:10:59] <rspijker> what command are you running?
[10:13:06] <dob_> rspijker: I am an idiot.... ;-) used mongoimport. Works better with mongorestore. Sorry for disturbing you!
[10:13:14] <molavy> json.dumps(response,default=json_util.default,ensure_ascii=False).encode("utf8")
[10:13:26] <molavy> why above line fail randomly
[10:13:54] <rspijker> dob_: heh, np :)
[10:14:24] <molavy> i can't understand when i 10 time click on a bottom that make same query why randomly generate above error
[10:15:47] <molavy> rspijker: remonvv: json_util.default is not stable
[10:17:34] <rspijker> or… the response you are getting is different every time and sometimes it contains something that isn't JSON?
[10:19:14] <rspijker> molavy: you probably want to write you own encoder, as explained here: http://stackoverflow.com/questions/16586180/typeerror-objectid-is-not-json-serializable
[10:24:55] <molavy> rspijker: i use that before , it return same error randomly
[10:25:44] <rspijker> molavy: the same error? When you convert all of your objectIDs to strings it still says can't convert ObjectID to JSON? Because then you are doing it wrong
[10:27:28] <molavy> rspijker: i should encode using code in above link before i can use use json.dumps(response,default=json_util.default,ensure_ascii=False).encode("utf8") ?
[10:28:17] <molavy> json.dumps(JSONEncoder().encode(response),default=json_util.default,ensure_ascii=False).encode("utf8") ?
[10:32:32] <rspijker> I'm guessing yes molavy. But I'm not that well-versed in python, so not sure what the different arguments to json.dumps are
[10:33:16] <molavy> it return {\"errs\": {\"name\":
[10:35:43] <remonvv> Hi Diganta
[10:35:58] <remonvv> molavy: default branches never are ;)
[10:36:19] <remonvv> molavy: Oh, different context, never mind.
[10:37:17] <Diganta> hi remonvv i need a help in hadoop mongodb connection
[10:42:34] <remonvv> Diganta: Okay, what's the problem?
[11:11:38] <Diganta> sorry remonvv , i was AFK
[11:12:58] <Diganta> remonvv: i need some sample code for connecting from hadoop to mongodb with configuring by programatically not by xml
[11:15:20] <remonvv> Diganta: That sounds like a job for #hadoop ;) Either way that should be googlable (word?). If you have MongoDB specific issues feel free to ask them here.
[11:17:30] <Diganta> no remonvv , right now i need the sample mapreduce code , ok thanks