[04:00:22] <alexband> does anybody can give me any hint?
[04:40:07] <kwallbmoc> Anyone here familiar with the Java driver?
[05:40:15] <sabrehagen> for two databases (e.g. localhost:27017/db1 and localhost:27017/db2), does inserting data in db1 put a write lock on db2?
[05:41:38] <sabrehagen> (and is there any difference in this activity between 2.6 and 3.0?)
[07:15:11] <amitprakash> Hi, I can connect and authenticate to a database as db = MongoClient('host:port')['database'].authenticate(user, pass) and execute queries as db[collection].find().count()
[07:15:49] <amitprakash> However, when I try to authenticate via mongo client as mongo host:port/database -u user -p pass it throws { ok: 0.0, errmsg: "auth failed", code: 18 }
[09:15:41] <abyss> To set range for sharding mostly I should use id key for my data in mongodb? So: sh.shardCollection(database.foo,id) should be enough?
[10:12:00] <joannac> abyss: um, no, sharding on the default _id is a terribl idea
[11:09:42] <pamp> @joannac why sharding on default _id is a terrible ideia?
[11:24:10] <amitprakash> Hi, I can connect and authenticate to a database as db = MongoClient('host:port')['database'].authenticate(user, pass) and execute queries as db[collection].find().count()
[11:24:12] <amitprakash> However, when I try to authenticate via mongo client as mongo host:port/database -u user -p pass it throws { ok: 0.0, errmsg: "auth failed", code: 18 }
[11:30:19] <sabrehagen> my mongod service is only listening on 127.0.0.1. how do i get it to listen externally?
[11:36:13] <Derick> on the cmd line it's --bind_ip 0.0.0.0 I *think*
[11:36:30] <Derick> but, I think by default it should bind to all IPs
[13:24:56] <jecran> Good morning mongo land. I am having issues with an import command from the command line: mongoimport --db test --collection restaurants --drop --file primer-dataset.json . Pulled straight from the site, and I keep getting an Unexpected identifier error. Quotes maybe?
[13:25:40] <goldstar> how would I got about removing records that are a month old from my db ?
[13:26:17] <joannac> jecran: why is there a dot at the end?
[13:26:35] <jecran> Cause I like to pretend I know some English :P
[13:26:39] <StephenLynx> goldstar from what I know, you can get the insert date from the default _id object.
[13:31:24] <joannac> jecran: so there's nothing in that collection?
[13:31:34] <joannac> i.e. not a single document gets inserted?
[13:32:07] <joannac> jecran: are you by chance trying to do this in the mongo shell?
[13:32:20] <jecran> Nothing being "imported" I can do a regular database, add a collection, then save and it works fine. Just the import I am stuck on. And yes, on the command line
[13:32:43] <joannac> jecran: on the command line, in a terminal?
[13:32:54] <joannac> jecran: or the command line *in a mongo shell*?
[13:32:59] <jecran> yes. mongod running in 1 terminal, and regular mongo in another
[13:36:55] <jecran> @joannac: this is the start to my day ,,, oh boy
[13:44:50] <abishek> is this condition correct? `"geo_country_iso" : {"$ne": [null,""]}`
[13:53:03] <amitprakash> Hi, I can connect and authenticate to a database as db = MongoClient('host:port')['database'].authenticate(user, pass) and execute queries as db[collection].find().count()
[13:53:04] <amitprakash> However, when I try to authenticate via mongo client as mongo host:port/database -u user -p pass it throws { ok: 0.0, errmsg: "auth failed", code: 18 }
[14:38:47] <GothAlice> abyss: Sharding on _id is perfectly acceptable… if what you want is pseudo-random (but even) distribution of your data across shards.
[15:24:20] <Thinh> Hi guys! Got a question regarding mongos
[15:24:25] <Thinh> Anyone seen this error before? https://gist.github.com/Taik/e42639ff7f68af3a4eb8
[17:00:18] <alobodig> Hi. Is using the positional projection operator ($) supported in the ‘fields’ part of a findAndModify command? e.g.: db.col.findAndModify({ query: { ’array.val’: 0 }, update: { $set: { ‘array.$.val’: 1 } }, fields: { ‘array.$’: true } }); It seems like it interprets the $ as the name of a field in array, but I might be overlooking something.
[17:28:43] <StephenLynx> http://docs.mongodb.org/manual/reference/command/cleanupOrphaned/ it seems so.
[17:36:05] <godzirra> Using the node mongo driver, how do I see the query I created? I'm trying to do a query by date, but in node it's not working, so I'm pretty sure I'm doing somethign wrong, just not sure what, and not sure how to view the query.
[17:36:46] <StephenLynx> you see the code you wrote.
[17:37:22] <StephenLynx> I don't remember seeing a way of getting the query the driver formed with the objects and array you provided and I have been using that driver for almost a year now.
[17:38:41] <godzirra> StephenLynx: The code I wrote looks correct to me, but it's obviously not. :) Here's the code I'm using: https://gist.github.com/slooker/0417d60841c2f70c99d7
[17:39:18] <Spec> can you just turn on query logging on mongo?
[17:40:05] <StephenLynx> 1- format the code, it makes much easier to understanding it. 2- I am pretty sure you must pass a callback to find to get the pointer you convert to array.
[17:40:32] <StephenLynx> personally I use nodeclipse, a plugin for eclipse.
[17:40:51] <StephenLynx> but given how bad eclipse can be, I understand if you chose not to.
[17:41:48] <godzirra> I'm not really suer what you mean about formatting the code. the reply is indented, I just forgot the closing brace to the collection.
[17:42:11] <godzirra> StephenLynx: And this code works exactly as is if I remove the "dateCreated" section from the query.
[17:44:04] <StephenLynx> that is a formatted query object.
[17:44:30] <StephenLynx> https://gitlab.com/mrseth/lynxchan/blob/master/src/be/public/boardDetails.js#L168 another query, without the block declared on a separate place.
[17:44:53] <StephenLynx> when you declare json objects completely lined it becomes really hard to understand their structure
[17:46:41] <girb1> In mongo 3.0.3 how to clean up the orphaned data ?
[17:47:11] <StephenLynx> have you read the link I pasted from the docs?
[17:49:36] <girb1> StephenLynx: yes .. I recently upgraded from 2.7 to 3.0 .. there seems to be orphaned data when I check it through db.colection.getShardDistribution() … the data is less here when compared to "show dbs"
[18:00:57] <vzp_> Can I have different mongo versions in a replica set? In my case I want to have 2.6 and 3.0
[18:38:03] <StephenLynx> GothAlice when you open a gridfs file on write and close it, when you open and write again will it first remove all previous data or keep writing from where it stopped since you last opened it?
[18:38:56] <GothAlice> StephenLynx: MongoDB is effectively stateless, so no, if you re-open the "file" and start writing again, it'll have a local file pointer of zero, i.e. the beginning of the "file".
[18:39:17] <GothAlice> s/effectively stateless/effectively stateless for this use/
[18:39:27] <StephenLynx> and if it writes less data than the file had? what happens to it?
[18:43:23] <GothAlice> That's a very good question. I'd have to double-check the docs and/or code.
[18:43:42] <GothAlice> (I've been auditing too much PHP recently. Can't think straight any more.)
[18:44:04] <StephenLynx> had to dig some mud lately too.
[18:44:19] <StephenLynx> to integrate a chat module I designed to the main project.
[18:44:35] <GothAlice> Always fun to run an emergency audit and code cleanup on a 16-year-old e-commerce site that was broken into with multiple exploits. :/
[18:45:03] <greyTEO> GothAlice, PHP is good for the soul!
[18:45:05] <GothAlice> (The "mysqli" upgrade for it was… painful. I'm pretty sure this is PHP 3 code.)
[18:45:32] <StephenLynx> greyTEO PHP is a hellspawn
[18:45:45] <StephenLynx> I had to fiddle with its C source code lately
[18:46:06] <StephenLynx> it didn't worked with an updated version of a dependency because of a hack of the developers.
[18:46:07] <faux___> i need help designing a database. nosql databases are an option. my data are lisp expressions, eg "(f (g 1) (g 2))". when evaluating the previous expression, i'll need to hit the database for the definitions of "f" and "g". in general, if an expression references other expressions, it should be easy to get to those other expressions. any advice is greatly appreciated
[18:47:05] <greyTEO> StephenLynx, I image the underlining code of terri-bad. Judging by the api.
[18:48:01] <greyTEO> I have been wanting to get into python for a while and Im trying every excuse to use it at work
[18:48:18] <StephenLynx> what purpose would you use python?
[18:48:20] <greyTEO> eeh ehhh my grating to GothAlice task queue using mongo
[18:52:57] <StephenLynx> seems that is more about mongo.
[18:53:02] <ngl> Hello. Somebody please answer this question: How do I use mongofiles with a bucket that is not fs? For example: mongofiles -d myDB -c templates get somezip.zip
[18:53:12] <GothAlice> StephenLynx: The end goal of transparently bridging function calls to a distributed cluster, including transparently bridging Python generator functions (iterables that "yield" multiple values before returning), is kinda boss.
[18:53:48] <StephenLynx> I remember sawing the implementation of generators and the yield keyboard on javascript. I gagged.
[19:01:26] <greyTEO> seems like that should be a thing already...
[19:02:19] <GothAlice> StephenLynx: It was a method of slurping in form data and populating a str_replace with all of that data, keys prefixed with $, for replacement in a template string. The security flaw is having a "from" address that includes newlines. >:D
[19:02:41] <GothAlice> (Beyond the code being unintelligible.)
[19:06:21] <girb1> I had one replica set at the beginning and I later added 3 replica set and made a sharded cluster …. now the cluster is imbalanced
[19:06:22] <girb1> i.e the first replica set contains more data (about 60%) of data. Balances ir running and its not balancing properly
[19:06:33] <girb1> Is there a way I can stop mongos insterting data into into my first replica set ?
[19:12:31] <ngl> GothAlice, is there a particular version of mongofiles I need to have to use the --prefix flag? I'm running 2.6.9 and am told the flag is unkown.
[20:14:00] <godzirra> StephenLynx: Meeting hell. Sorry. I reformatted the data and posted it here: https://gist.github.com/slooker/0417d60841c2f70c99d7
[20:14:54] <StephenLynx> yeah, I am almost sure you need to get the result from the callback on the find.
[20:15:04] <StephenLynx> and then run toArray on the cursor.
[20:18:33] <GothAlice> StephenLynx: Find is lazy in every driver I've gone source-diving through. I.e. the result of .find() actually doesn't do much. It's iteration that commits the query and runs it, prior to that other methods can adjust the parameters of the query in a nice, chainable way.
[20:18:54] <GothAlice> koboldthegreat: One of the route registrations you have added is badly formatted in some way.
[20:19:09] <StephenLynx> yeah, I really thought it was inconvenient to have to run callback from callback from callback
[20:19:41] <StephenLynx> so you can just do a find().sort().limit().toArray instead of using an aggregate and still keeping it using just a single callback?
[20:19:55] <GothAlice> That _should_ be one callback.
[20:20:14] <GothAlice> In non-async drivers that'd return rather than taking a callback.
[20:20:37] <StephenLynx> will make sure of that. the main reason I used aggregate for everything is that I thought I would have to use one callback for each operation.
[20:20:48] <GothAlice> (In a similar way that find().sort().limit().forEach(callback) is a single callback.)
[20:21:13] <GothAlice> find() returns a cursor. .sort() returns a new, mutated copy of that cursor. .limit() repeats this.
[20:21:31] <GothAlice> Only actual iteration (forEach, toArray, etc.) will execute the query defined by that cursor object.
[20:22:15] <StephenLynx> doesn't find also accepts an callback that yields the cursor, though?
[20:22:23] <GothAlice> Also: it's important to stress that these chain methods (sort, limit, etc.) return _copies_. They _do not_ modify the original. This makes partial chaining and conditional chaining a viable thing.
[20:23:30] <StephenLynx> nah, I use the official driver, I am pretty sure it allows for that, checking my last project right now.
[20:24:01] <StephenLynx> https://gitlab.com/hub1dev/hub1/blob/master/src/be/boot.js#L352 ye
[20:24:11] <StephenLynx> I thought that this was the only option :v
[20:24:22] <godzirra> StephenLynx: But if I remove the dateCreated section, it works fine.
[20:24:39] <godzirra> StephenLynx: It's literally just teh dateCreated section that I add that breaks it. I can only assume i'm setting up dates wrong or something?
[20:24:47] <GothAlice> StephenLynx: http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#find You're not using the official driver, you're using an async fork.
[20:28:45] <GothAlice> StephenLynx: Then you're doing it wrong and should fix your code to not use a callback on find(). As you noticed, the entire concept of having a callback there is kinda silly, since find() returns the cursor anyway.
[20:29:11] <GothAlice> No wonder you wanted to avoid it. ;)
[20:29:16] <StephenLynx> the point is that the code is working despite the documentation not specifying you can use a callback.
[20:29:46] <GothAlice> Undocumented features should not be relied upon. There is no promise that it'll work in any future (or past, for that matter) version.
[20:31:44] <StephenLynx> and use pretty() in the end.
[20:32:17] <StephenLynx> also print what startDate is before the query.
[20:34:17] <godzirra> StephenLynx: https://gist.github.com/slooker/0417d60841c2f70c99d7 Line 26 is the data. this is in the mongo console. Line 10 is the results of console logging the start date.
[20:35:15] <StephenLynx> probably its because you are using a string to query
[20:35:21] <StephenLynx> when it has a date object saved
[20:35:57] <StephenLynx> I don't see a field dateCreated on your docs, is that how you query for the creation date on the _id? I am not familiar with it.
[20:36:34] <StephenLynx> keep in mind you use actual objects when in the console
[20:36:43] <StephenLynx> that is probably why it works there.
[20:37:02] <StephenLynx> if you remove that call to toISOString it will probably work.
[20:37:29] <StephenLynx> and you are using "dateReported" on the console and "dateCreated" on the application.
[20:37:50] <StephenLynx> yeah, probably these are the two errors.
[21:24:22] <okanck> i will reserch joannac. thanks
[22:13:03] <grazfather> is there a way to upsert where the spec for the search is written without having to rewrite? e.g. db.test.update({"ip":1,"host":2},{"field":"test"}, upsert=true) but the result contains ip 1 host 2 in addition to the field:test?
[22:23:28] <grazfather> I guess I could do $setOnInsert: <ref to spec>