PMXBOT Log file Viewer

Help | Karma | Search:

#mongodb logs for Tuesday the 29th of April, 2014

(Back to #mongodb overview) (Back to channel listing) (Animate logs)
[00:32:09] <the8thbit> I want to sort a collection by a field inside of a subdocument inside of an array. Is this possible?
[00:34:01] <joannac> the8thbit: if your array has multiple documents, how would that sort?
[00:34:26] <the8thbit> joannac: I only want to sort by one particular document in the array
[00:34:56] <the8thbit> I have a collection called 'badges' and each badge has an array of 'owners', and each owner has a 'username' and a 'date'.
[00:35:17] <the8thbit> I want to sort by the owner's date (the date they acquired the badge)
[00:38:39] <joannac> I think no, this is what I was thinking of http://docs.mongodb.org/manual/reference/operator/projection/positional/#sorts-and-the-positional-operator
[00:39:51] <the8thbit> <joannac> I think no <--- its not possible?
[00:40:55] <joannac> You could potentially try using the aggregation framework
[00:41:06] <joannac> but I don't think you can do it via a normal find()
[00:41:16] <the8thbit> joannac: I dont understand how aggregation works :(
[00:42:29] <joannac> :/ read the docs? or do M102 (which goes through it)
[00:43:36] <the8thbit> M102?
[00:44:59] <the8thbit> Can I get the M102 lectures online anywhere, or do I have to sign up for the course?
[00:45:22] <the8thbit> I found the docs to be very confusing
[00:45:58] <joannac> you need to sign up
[00:47:15] <the8thbit> actually, looks like they're on youtube
[03:44:37] <tpayne> Hello. how can i return just a single specified value in an array? Like ["1","2","3"]
[03:45:06] <tpayne> each time i return something, it returns [{"key":"1"},{"key":"2}]
[12:24:14] <eskatrem> hey, noob question here: I have mongodb running on machine A, and typing on machine B: mongo --host myIp --post myPort gets me a "connection refused"
[12:28:32] <Nodex> default mongo binds to 127.0.0.1 now
[12:32:05] <eskatrem> well, that's why I ran it with --host myIp
[12:34:46] <thanasisk> how can i install 2.6.1-rc0 on ubuntu 12.04? apt-get install mongodb will install 2.6.0 (which owing to a bug we cannot use)
[12:38:28] <Nodex> eh?
[12:38:42] <Nodex> mongo != mongod
[12:39:23] <Nodex> thanasisk : mongodb-org ?
[12:39:57] <Zelest> o/
[12:40:07] <thanasisk> i dont understand what you are trying to say, is this not the mongodb channel?
[12:40:39] <Nodex> [13:38:51] <Nodex> thanasisk : mongodb-org ?
[12:40:44] <Nodex> apt-get install mongodb-org
[12:41:04] <Nodex> my "eh?" wasn't aimed at you
[12:41:54] <thanasisk> mongodb-org is already the newest version. <— im sure that in another box configured by someone else i could get the 2.6.1-rc0 by apt-get install
[12:42:05] <thanasisk> Nodex: thanks for clearing this up :
[12:42:57] <Nodex> I am not sure what version mongodb-org-unstable is
[12:43:06] <Nodex> it would suggest its the latest RC
[12:45:12] <thanasisk> so, how do I install the latest RC on ubuntu 12.04?
[12:46:23] <Nodex> try mongodb-org-unstable
[12:46:33] <thanasisk> let me try that - cheers
[12:47:28] <thanasisk> nope - this installed 2.5.5
[12:47:30] <Nodex> else from source https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-2.6.1-rc0.tgz
[12:58:39] <thanasisk> Nodex: i found out what the issue was https://jira.mongodb.org/browse/SERVER-13691
[13:00:50] <Nodex> oh dear
[13:05:22] <thanasisk> i installed from tarball - thanks for the help Nodex
[13:13:06] <thanasisk> is there an estimated release date for 2.6.1 stable?
[13:13:40] <thanasisk> i recall from a JIRA ticket that it should have been yesterday the 28th
[13:27:54] <cheeser> i think the official line is "real soon now." :)
[13:39:45] <miqui> newb question: i realize that the OS will manage mem for mongodb's cache mem, etc..etc.. but just wondering i have a small collection to deal with with(< 40 objects)
[13:40:08] <miqui> so, i should be "ok" with a 1gig VM ?
[13:40:45] <miqui> only a few things running.... in the same VM... with large swap file
[13:42:43] <Nodex> depends on how large the objects are
[13:43:17] <miqui> Nodex: hmm, yes, lets say <10k bson
[13:43:27] <Nodex> but seeing as there is a 16mb limit on documents currently then you should be fine :)
[13:43:49] <Nodex> less than 0.5mb will NOT use 1gb of ram
[13:44:44] <miqui> Nodex: if true that mongo will release its cached ram because the OS asked it to for another process...and then i can live with that..
[13:45:05] <miqui> Nodex: i just dont want it to hog things...
[13:45:13] <Nodex> the OS will just eject using LRU
[13:45:49] <miqui> Nodex: want to replace mysql (very small db, one table 20 records, key/val pairs)
[13:46:09] <Nodex> :)
[13:46:20] <miqui> Nodex: OS=ubuntu 12.02 LTS so your statement applies ?
[13:49:06] <Nodex> 12.04
[13:49:34] <Nodex> and yes it applies to all *nix based OS's as far as I know. I couldn't comment on winblows or freebsd though as I don't use them
[13:50:16] <miqui> Nodex: k, cool thanks
[14:19:36] <pure> So, I'm using the C# driver. If I do something like 'collection.FindOneById<Entity>().Name = "foo";' do I need to explicitly call collection.Save() or collection.Update()?
[14:34:04] <cheeser> pure: yes
[14:47:57] <pure> So it might be a good idea to put a collection.Update() call in my property setter?
[14:54:07] <rspijker> don't know the C# driver, but in general you would have to call save
[15:02:27] <cheeser> pure: no, it wouldn't be a good idea
[15:02:40] <cheeser> it could potentially generate tons of traffic.
[15:04:46] <pure> What's the best way to make sure client and server are always synced then?
[15:57:09] <ninja_p_> when creating an index using the php client is order important? - we create the index on the server with ensureIndex({a,1,b:1,c:1}) but adding via PHP leaves no way to ensure the attribute order (its just an assoc array)
[16:08:07] <Nodex> yes order is important
[16:08:24] <Nodex> and php will keep the order you give it in the array
[16:09:03] <Nodex> (arrays would not be much good without a predictable order else :P )
[16:30:17] <gsd> is there a mongo call that will show me the connection pool stats, like the number of avail connections in the pool
[16:54:37] <hydrajump> if you use pymongo and save a query in the var cursor. when you loop through the docs in the cursor how can you skip every other result. It's probably more a python question but I thought I'd try here
[18:04:20] <moleWork> whenever i restart the mms monitoring agent... it won't reconnect to my server, it says "Either not primary agent, or no hosts configured. Sleeping...
[18:04:20] <moleWork> "
[18:06:47] <moleWork> oh there we go
[18:06:57] <moleWork> just takes a 5 mins or so
[18:35:04] <NaN> how can I update an inside doc if the inside doc is in an array? { foo: [ bar: { baz: true }, baar: { baz: false } ] } <<< update foo.baar.baz ?
[18:38:23] <Edravis> Hi! I think I found a small error in the web mongodb manula, how can I report it?
[18:38:29] <Edravis> *manual
[18:54:43] <betz> Hi. Is it possible to update multiple documents in a single atomic operation?
[18:57:53] <NaN> I don't get it... why find({_id: ..., foo.baar: { $exists: true }) works but find({_id: ...}) doesn't?
[18:57:58] <tscanausa> betz, that depends, but simply I would say no
[18:58:37] <tscanausa> NaN: race conditions?
[18:58:48] <NaN> I mean, why does the positional operator needs the query with the array field?
[19:16:17] <skot> NaN: because the the positional operator ($) is just a specific array element which is replaced during the update, if your query doesn't query an array, then it can't match anything.
[19:23:46] <frodo_baggins> I keep getting: planner returned error: need exactly one text index for $text query, at the beginning of my code I call db.<collection>.ensureIndex({"text": 1}, callback);
[19:24:44] <moleWork> how do you set "client name" in node.js native driver with a description... like instead of conn1-10 i can set it to myapp1-10
[19:25:20] <moleWork> i can see like TTLMonitor and other processes can do it, i was wonder if it was possible to prefix the client in the node.js connection pool options
[19:34:14] <NaN> skot: but find with _id and find with _id and array element gives me the same results
[19:42:15] <skot> NaN, they give you the same document but not the same context in that document for the update.
[19:47:47] <ranman> NaN: this may elucidate https://gist.github.com/ranman/289fc4b0561b2f72f4c3
[19:59:22] <ThePrimeMedian> anyone had this issue? MongoError: exception: nextSafe(): { $err: "Can't canonicalize query: BadValue unknown top level operator: $inc", code: 17287 }
[19:59:28] <ThePrimeMedian> mongo --version says 2.6.0
[20:00:09] <hell_razer> ThePrimeMedian can you show full your query code?
[20:00:21] <ThePrimeMedian> sure, two seconds
[20:03:11] <ThePrimeMedian> hell_razer: it's a mongoosejs schema call, http://hastebin.com/ifodafofeh.coffee
[20:03:33] <NaN> skot: where can I read more about that 'context'?
[20:03:58] <NaN> ranman: thanks man, but what if I need to update another arrays? should I need to include them in the query too?
[20:04:28] <ranman> NaN: could you create an example?
[20:04:55] <hell_razer> ranman, i am not familiar with mongoose, but your query looks really starnge, what exactly you want to do?
[20:04:55] <ranman> NaN: I'm not super smart and it's hard for me to talk about these things in abstract terms especially when vim is open in another window :P
[20:05:12] <hell_razer> ThePrimeMedian i am not familiar with mongoose, but your query looks really starnge, what exactly you want to do?
[20:05:17] <hell_razer> ranman miss
[20:05:21] <ranman> NP
[20:06:22] <ThePrimeMedian> hell_razer: i just want to update the doc, increment the counter, and if not exist create the document with a count of one.
[20:06:36] <ThePrimeMedian> i'll look into it a little further and come back.
[20:06:44] <ThePrimeMedian> thought the error might of been mongodb 2.6.0
[20:06:57] <ThePrimeMedian> because it was working with 2.4.9
[20:13:06] <hell_razer> ThePrimeMedian, therei no breaking changes in mongo 2.6
[20:13:09] <hell_razer> ThePrimeMedian http://docs.mongodb.org/manual/reference/method/db.collection.findAndModify/#upsert
[20:14:21] <ThePrimeMedian> hell_razer: it was the lodash library
[20:14:59] <ThePrimeMedian> fixed. thnx
[21:16:45] <frodo_baggins> I've managed to create a text index, but when I do a search, I get null for the results. Code here: https://gist.github.com/blafreniere/e6cc730e6b00330af0d2
[21:22:59] <frodo_baggins> could I have needed to do... .toArray(error, document)?
[21:23:19] <frodo_baggins> oh, yes, it appears that is the case.
[21:24:02] <ranman> frodo_baggins: figured that out just as you typed that
[22:21:45] <NaN> ranman: +1 for vim
[22:28:38] <ranman> NaN: wat? vim?
[22:28:58] <ranman> oh, re my comment earlier
[23:15:25] <TheFinal> need some hint on how to be able to connect my ios app to a remote mongodb...
[23:38:40] <xissburg> thatcher: http://www.raywenderlich.com/61078/write-simple-node-jsmongodb-web-service-ios-app
[23:38:43] <xissburg> TheFinal: http://www.raywenderlich.com/61078/write-simple-node-jsmongodb-web-service-ios-app
[23:39:18] <TheFinal> what if on the server there is no node.js?
[23:39:51] <thatcher> ah, I guess that was not for me :-p
[23:39:55] <thatcher> np
[23:42:55] <mfen> i'm using mongoengine in python but i sudently have need to learn how to do raw mongo queries
[23:43:08] <mfen> however, none of the examples i've found for doing a query through a dbref seem to work
[23:43:45] <mfen> can anyone supply me with a simple example that works in 2.4.6?
[23:43:59] <mfen> i have db.interview and db.user
[23:44:11] <mfen> db.interview has a user parameter which is a dbref to db.user (i think.)
[23:44:18] <mfen> (at least, that's how it works in my python code.)
[23:44:24] <mfen> so i want:
[23:44:43] <mfen> db.interview.find({'user.$id': ObjectId('xxxxxxxx')})
[23:44:54] <mfen> or better yet, db.interview.find({'user.email': 'blah@blah'})
[23:45:03] <mfen> neither of these forms works. neither does this:
[23:45:19] <mfen> db.interview.find({user: {$ref: 'user', $id: ObjectId('xxxxx')}})
[23:45:54] <mfen> i can query that object directly through db.user.find. i can query the interview directly with db.interview.find({_id: ObjectId('yyyyy')}
[23:46:34] <mfen> but i can't query the interview by matching through the user object. i don't understand why there's no simple example of this. in any other database it would be a trivial foreign key join. (and mongoengine seems to have no problems doing it.)
[23:48:34] <mfen> btw i'm running these queries in the mongo CL shell