[01:03:45] <RoryHughes> Is there anyway I can tail a log of all queries in the javascript format on my development mongod?
[01:35:21] <boomer> hi everyone, so I am trying to implement a hierarchial filesystem using GridFS. I am thinking of creating a new bucket to represent a new folder. In order to represent the hierarchy, I create an empty file in each of the buckets; the contents of this file being just the metadata containing an array of the name of the buckets that are sub dirs of this bucket... And when I need to figure out the subdirs of a given bucket I just read the me
[01:36:24] <boomer> although I always have the option of naming my bucket using the full path name eg /a/b/c... just thinking that the first approach will be easier to work with if I have to implement unix like permission model.
[03:31:08] <daniel-s__> Hi, I have a question about 'save'
[03:32:13] <daniel-s__> If I use db.media.save({"name":"bob"},{"name":"fred"}) it is my understanding that it will find the first document with the name "bob" and replace it with a new document that has only one field, "name", now called fred.
[03:33:00] <daniel-s__> But I have found it is creating a new {"name":"bob"} instead.
[09:45:38] <kali> i can't remember a time when save() was updating without being given an _id
[12:54:54] <justanotherday> I need to convert a large sql dump file to json, can anyone please advice on how best to do this
[13:27:04] <kali> justanotherday: you have two kind of ways: one is to import the sql dump back into the appropriate database, the other is to parse the SQL dump yourself
[13:35:11] <smolinari> It isn't mysql, but it should get you closer. http://www.anthonydebarros.com/2012/03/11/generate-json-from-sql-using-python/
[13:36:59] <justanotherday> smolinari: Thanks will look
[13:38:29] <kali> you're sure you can't get the data back into a mysql ?
[13:40:42] <justanotherday> Kali: Yes am sure, It is possible, but I am supposed to take the hard route and parse the dump, problem is its my first time playing around with databases and programming langs
[16:59:12] <justanotherday> please can anyone gimme ideas on how to prase a .sql file to json
[17:48:30] <ministry> I'm trying to build a document tagging and retrieval application as my senior thesis project. Will MongoDB a proper database to use?
[19:01:14] <fruitFly> how do I find the number of records in a mongo collection?
[19:40:04] <kali> collections are not explicitely ordered, so it would not make much sense
[21:12:08] <ryansteckler> Hiya. My brain is twisted up in a knot trying to get my 2-level nested array update working. I have an object in the database: {game: { players: [ { userId: "123", moves: [ { description: "punch" } ] } ]. I'm trying to $set another field on that inter array. I have something like: update({ _id: gameId, "players.userId": "123", "players.moves.description": "punch" }, {$set: {players.$.moves.$.target: "face"}
[21:13:16] <ryansteckler> That gives me an error about the update array not being in the query, which i think I understand because players.moves.description doesn't match the particular move I'm looking for.
[21:14:11] <ryansteckler> I'm not sure how to query for "the move who's description is 'punch' that belongs to the player who's ID is '123'"
[21:14:26] <ryansteckler> That second level nested array is messing me up
[21:19:14] <ryansteckler> I think $elemMatch is part of the answer, but not sure how to apply it to the problem
[21:34:51] <ryansteckler> This might be an easier way to describe the problem. I need a query that lets my update be: "players.$.moves.$.target": "face", but I'm getting the error: Cannot apply the positional operator without a corresponding query field containing an array.
[22:10:36] <ryansteckler> Ok. I think I don't understand $elemMatch, and that's causing the problem. My understanding from the docs is that $elemMatch returns only the array items that match. What I'm seeing is that $elemMatch returns the entire array. Here is a very short shell result that shows the problem: http://nopaste.info/9860f12d70.html
[22:39:05] <joannac> the positional operator only goes 1 deep
[22:39:41] <joannac> (on a phone so can't tell if that solves your problem Or not)
[22:40:29] <ryansteckler> Just figured that out, and found the feature request for multiple levels: https://jira.mongodb.org/browse/SERVER-831
[22:41:02] <ryansteckler> Thank you. It looks like nested documents are the suggested workaround until multi-level $ is resolved. I'll try to restructure the model that way instead.
[22:41:28] <ryansteckler> For the archives, here is the suggestion to use refs instead of arrays to work around this limitation: http://stackoverflow.com/questions/4121666/updating-nested-arrays-in-mongodb
[22:41:42] <joannac> can You do a projection of players.$
[22:42:33] <joannac> that Should only get You the matching one i think
[22:49:49] <ryansteckler> I'm not totally clear on the projection stuff. My understanding is that with findAndModify, the projection only specifies what is returned as the result document...
[22:50:33] <ryansteckler> I'm going to redesign the schema to hardcode two players, which is all I need right now anyway