PMXBOT Log file Viewer

Help | Karma | Search:

#mongodb logs for Sunday the 2nd of November, 2014

(Back to #mongodb overview) (Back to channel listing) (Animate logs)
[02:01:36] <GothAlice> Oh, scrandaddy, I wish you were still around.
[04:05:41] <uptownhr_> can someone tell me if i have to use $and for this to be an and clause?
[04:05:41] <uptownhr_> http://pastebin.com/S3y1TRHM
[04:05:46] <uptownhr_> or is it good as is?
[04:22:09] <diegoaguilar> Hello, how can I model with Mongoose a Date object which will be equal to Date.now()+2months
[04:22:17] <diegoaguilar> I got an example of what Im trying here
[04:22:18] <diegoaguilar> https://gist.github.com/diegoaguilar/4a63dff125d0f039226d
[04:46:55] <annoymouse> hey
[05:00:02] <uptownhr_> diegoaguilar: can you elaborate on what you are trying to do?
[05:13:36] <diegoaguilar> uptownhr_, I achieved what I was trying to to
[05:13:51] <uptownhr_> kk, cool
[05:14:18] <diegoaguilar> however, uptownhr_ I got a question, ti's actually about mongoose ... what's difference between using schema.methods and schema.static for injecting methods to them
[05:14:32] <diegoaguilar> schema.statics*
[05:15:11] <uptownhr_> method is for the instance
[05:15:17] <uptownhr_> static has no instance
[05:15:28] <uptownhr_> so method expects that you have already pulled a model
[05:15:37] <uptownhr_> so if you had a Sites model
[05:15:54] <uptownhr_> sites.findone(function(err,site)
[05:16:11] <uptownhr_> the method will be available on the site model
[05:16:26] <uptownhr_> static, will only be available on the Site
[05:16:40] <uptownhr_> does that make sense
[05:17:10] <uptownhr_> i normally use statics for like a helper query method
[05:17:44] <diegoaguilar> it's actually an static method in OOP :P
[05:18:14] <uptownhr_> yea
[05:18:44] <diegoaguilar> using methods ... first argument is callback ... but secound would be actual method argument?
[05:19:01] <diegoaguilar> because for statics I saw that first one would be argument and second the callback
[05:19:20] <uptownhr_> that'll depend on the method i believe
[05:19:23] <uptownhr_> can't remember
[05:19:33] <uptownhr_> i think it's up to you to decide on where the callbak is
[05:19:36] <uptownhr_> don't think there is a standar
[05:19:53] <uptownhr_> when you create the method = function(options, cb)
[05:19:59] <uptownhr_> you'll have to handle that cb if you want a call back
[05:21:03] <diegoaguilar> I get a bit confused in this last ..
[05:21:11] <uptownhr_> haha
[05:21:17] <uptownhr_> you familiar with javascript?
[05:22:05] <diegoaguilar> I use it but Ive never learned it 100 % :P
[05:22:11] <uptownhr_> ic
[05:22:23] <uptownhr_> so short answer, they can both have the cb as the second parameter
[05:22:27] <uptownhr_> it's up to you to decide
[05:22:35] <uptownhr_> following convention, you would make it second
[05:22:46] <uptownhr_> when you create your static or method,
[05:22:51] <diegoaguilar> ok
[05:23:05] <uptownhr_> it can be function(options,cb) or function(cb,options)
[05:23:20] <uptownhr_> it is up to that method to call the cb
[05:23:21] <diegoaguilar> why do they often do a var something = this;
[05:23:26] <diegoaguilar> in those statics and methods?
[05:23:43] <uptownhr_> it's just for scoping
[05:23:57] <uptownhr_> var ensures that variable is for that scope
[05:24:11] <uptownhr_> without var, you may change something from it's parent scope
[05:24:25] <diegoaguilar> so this is the actual model or schema?
[05:24:40] <diegoaguilar> first I thought this to be the "method"
[05:24:48] <diegoaguilar> but it makes no sense I think
[05:25:04] <uptownhr_> are you talking about 'this' the object pointer?
[05:25:45] <diegoaguilar> yep
[05:26:57] <uptownhr_> in a static, this = the new schema.Model
[05:27:23] <uptownhr_> in a method, this = new Model()
[05:27:41] <uptownhr_> so Site = new schema.Model('Site')
[05:27:48] <uptownhr_> Site.static
[05:28:00] <uptownhr_> site = new Site()
[05:28:01] <uptownhr_> site.method
[05:29:21] <diegoaguilar> ok, get it :)
[05:29:31] <uptownhr_> from within site.method, you can also gain access to static by this.model('Site').static
[05:29:36] <uptownhr_> cool
[05:32:37] <diegoaguilar> great, thanks
[05:33:23] <diegoaguilar> oh do you know why any recent created database will be 0.078 GB
[05:33:24] <diegoaguilar> ?
[05:33:36] <diegoaguilar> I just last mongodb version
[05:40:09] <uptownhr_> diegoaguilar: notsure what you mean
[05:42:49] <diegoaguilar> yep, whenever I start inserting first document to a database
[05:43:18] <diegoaguilar> the ouput of show databases will tell every recent created database is 0.078 GB
[06:28:54] <uptownhr_> but what is the question?
[07:24:59] <diegoaguilar> I was wondering if that's "normal" uptownhr_
[07:25:17] <uptownhr_> ah, no idea
[07:25:22] <uptownhr_> never paid attention to it
[10:25:30] <dreambox> hey dudes! wassup today !
[10:39:42] <dreambox> I have a question... I am using a MeanJS stack.. has a scheme by default, all is good. Now I want to add a property/key, but it will have keys inside it as well...
[10:40:24] <dreambox> I am reading http://mongoosejs.com/docs/2.7.x/docs/model-definition.html and I am wondering should I use an array thingie and make a new schema and insert it as a value of the original schema
[10:41:04] <dreambox> or should I directly write json type .. {location : { "lat": ... , "long": ... } }
[10:55:07] <dreambox> here is how my model looks like : https://gist.github.com/ff8b66af904fb8e53d7b
[12:53:31] <Monotoko> I'm trying to run a repair on a database that's crashing out on me
[12:53:46] <Monotoko> however it won't run unless I shut it down clearly
[12:53:48] <Monotoko> *cleanly
[12:53:55] <Monotoko> which I can't do because it's crashing...
[13:00:48] <drag0nius> how do i use $in inside $cond?
[13:01:04] <drag0nius> i'm getting "failed: exception: invalid operator '$in'"
[13:01:41] <drag0nius> for this query http://wklej.org/hash/0055075ac11/
[14:27:16] <jonjons> I have a db where I have marked 90% of the records as "deleted" without actually deleting them, I want to keep them but they no longer need to be indexed etc
[14:27:21] <jonjons> what is the best strategy here?
[17:37:32] <esmalling> trying to run MongoDB with ssl, built 2.6.5 from source, am getting the following in the log at startup: invalid char in key file /var/lib/mongodb/ssl/ssl/mongodb-rs.pem: -
[17:37:37] <esmalling> that file should be fine
[17:37:42] <esmalling> ASCII encoded
[17:39:14] <esmalling> it’s a concat of key and cert from openssl using the exact args described here: http://docs.mongodb.org/manual/tutorial/configure-ssl/
[17:44:54] <flyingkiwi> esmalling, so there are 2 parts delimited by "-----BEGIN PRIVATE KEY-----" and "-----BEGIN CERTIFICATE-----"?
[17:45:04] <esmalling> yes
[17:45:38] <esmalling> I’m looking at my colleagues mongod.conf arg choices now - they may be using the wrong property naming
[17:47:04] <flyingkiwi> because I see an error in the documentation
[17:47:29] <flyingkiwi> ah, my fault. no, its fine
[17:49:00] <flyingkiwi> is there a newline between "-- end private key --" and "--- begin certificate ---"?
[17:50:30] <flyingkiwi> at least openssl won't parse it
[17:51:31] <jedichu> should be
[17:56:38] <esmalling> sorry - it looks like my coworker was trying to use a .pem file for the replication keyFile setting - when I put it in the correct net.ssl.PEMKeyFile param, it’s working
[17:56:46] <flyingkiwi> esmalling, you could try to parse it with openssl - it may give you a better understanding whats wrong with that file. "openssl x509 -in mongodb.pem -noout -text" and "openssl rsa -in mongodb.pem -noout -text"
[17:56:47] <esmalling> thanks for your help though
[20:12:40] <nacsurte> is there a good mongodb client that has similar features to that of Sequel Pro for mysql?
[21:21:04] <nylon> lo
[21:54:38] <dimon222> dont think so, mongodb clients are pretty sh...
[21:57:00] <nylon> using mongodb version 2.4.9, I'm currently experiencience the following error when attempting to execute 'eval()' against any given database with an error message of:
[21:57:27] <nylon> not authorized on [DB NAME] to execute command { $eval:
[21:57:56] <nylon> I have tried running the following command:
[21:57:59] <nylon> db.grantRolesToUser("sa",[ "clusterAdmin", "userAdminAnyDatabase", "dbAdminAnyDatabase", "readWriteAnyDatabase" ] )
[21:58:22] <nylon> restarted mongo (windows version 2.4.9)
[21:58:35] <nylon> the error message persists
[21:58:55] <nylon> when I look at the privileges
[21:59:33] <nylon> it shows the user having the roles I assigned it
[21:59:43] <nylon> any help would be great
[21:59:46] <nylon> thanks
[22:02:10] <joannac> nylon: did you authenticate before running eval?
[22:02:33] <nylon> yes... i'm using robomongo shell
[22:03:24] <nylon> happens in my c#, php projects as well, since I added athentication
[22:03:37] <joannac> let's see the user document
[22:03:43] <joannac> pastebin?
[22:03:49] <nylon> k
[22:06:02] <nylon> http://pastebin.com/y2uRE17s
[22:06:38] <joannac> you're not running 2.4.9 btw
[22:08:20] <nylon> yes
[22:08:26] <nylon> i am
[22:08:41] <nylon> or you're stating that i'm not?
[22:09:56] <nylon> should i upgrade to 2.6+ ?
[22:10:05] <nylon> does that make the issue go away?
[22:11:57] <joannac> If you are, your user documents are in 2.6 format
[22:12:47] <nylon> does it matter if i ran db.getSiblingDB("admin").runCommand({authSchemaUpgrade: 1 });
[22:12:57] <nylon> i did, however, it did not help
[22:13:11] <joannac> yes
[22:13:13] <joannac> it does matter
[22:13:17] <joannac> why did you run that?
[22:13:43] <nylon> read somewhere on the internet to get rid of the error
[22:14:22] <nylon> so this does not happen in 2.6?
[22:14:35] <nylon> or am i going down another rabbit hole?
[22:15:55] <joannac> you are trying to run 2.4 with 2.6 users
[22:16:02] <joannac> I don't even know if that works
[22:16:15] <nylon> how can you tell?
[22:16:19] <joannac> I'm pretty sure it doesn't
[22:16:26] <joannac> well, your users are in 2.6 format
[22:16:33] <joannac> and you claim you're running 2.4
[22:16:51] <Derick> joannac: you know when you can downgrade the user documents?
[22:17:01] <nylon> let me login and double check
[22:17:04] <joannac> Derick: yeah, you can.
[22:17:09] <Derick> how?
[22:17:18] <joannac> Derick: http://docs.mongodb.org/manual/release-notes/2.6-downgrade/#downgrade-user-auth-model
[22:17:22] <Derick> cheers :-)
[22:18:26] <Derick> joannac: looks a whole lot harder than upgrading :-)
[22:18:57] <nylon> i'll be darn:
[22:19:07] <nylon> it's version 2.6.3
[22:19:37] <joannac> well, that's progress
[22:19:52] <joannac> let me spin up a 2.6.3 instance and test
[22:19:59] <nylon> k
[22:21:16] <nylon> i'm curious if you will be able to execute db.eval(function(){ return 'Hello'}); without error
[22:23:49] <joannac> nylon: "If you need access to all actions on all resources, for example to run the eval or applyOps commands, do not assign this role. Instead, create a user-defined role that grants anyAction on anyResource and ensure that only the users who needs access to these operations has this access."
[22:23:59] <Bilge> 0
[22:24:23] <joannac> you need more privileges in 2.6 to run eval
[22:25:09] <joannac> you already know that eval is bad, right?
[22:25:20] <nylon> OMG... serious?
[22:25:59] <nylon> i'm executing aggregation in my web application code
[22:26:17] <nylon> so that it executes faster on the server using nolock
[22:26:48] <joannac> ?
[22:27:08] <nylon> is it bad due to security, or because most devs forget to use 'nolock' in the aggregation query ?
[22:27:42] <joannac> I don'
[22:27:49] <joannac> t understand why you're running in eval
[22:28:01] <joannac> why do you need eval?
[22:28:01] <nylon> for speed
[22:28:05] <joannac> what speed?
[22:28:10] <joannac> you're not taking the global lock
[22:28:22] <nylon> no
[22:28:33] <nylon> in my application, i'm using a driver
[22:29:01] <nylon> i write my queries in robomongo
[22:29:18] <nylon> we would like to simply carry that effort to the eval
[22:29:30] <nylon> so that we write the query once in javascript
[22:29:39] <nylon> but since, eval is bad
[22:29:55] <nylon> that kills our efforts of code reuse
[22:30:21] <joannac> oh, you're using server side js
[22:30:27] <nylon> yes
[22:30:41] <joannac> ugh
[22:30:47] <nylon> not stored
[22:30:54] <joannac> okay fine, if you must, go create yourself a superuser
[22:30:58] <joannac> http://docs.mongodb.org/manual/reference/command/eval/#access-control
[22:31:16] <nylon> that's all i have to do?
[22:31:20] <nylon> really?
[22:31:22] <nylon> ok
[22:31:48] <joannac> you could just rewrite your queries using the driver instead of creating a superuser
[22:32:29] <nylon> code reuse is another goal
[22:33:30] <nylon> and we can bring dev's in that understand javascript queries rather than learning this dirver or that drivers syntax
[22:33:44] <joannac> if it were me, turning js code into python/ruby/whtever code is a much better solution than using db.eval()
[22:34:13] <nylon> so just grant my sa user
[22:34:21] <nylon> role : 'anyActon'
[22:34:22] <nylon> ?
[22:46:55] <nitestryker_> Hello everyone
[22:47:54] <devguy01> Hello , I have a question I was hoping someone in here could shed some light on
[22:48:25] <Boomtime> Hi, ask away
[22:49:21] <devguy01> I am writing an app in PHP using MongoDB and for some reason the data is adding \r\n in my variable but last night it wasnt doing that so im not sure what has changed
[22:49:57] <devguy01> I've tried using str_replace to remove them but not having much luck
[22:51:06] <okapi> hi
[22:51:11] <devguy01> there is no spaces at all the spaces have been replaces by \r\n and its all jumbled together
[22:51:43] <okapi> i hope this is not too much of a stupid question but how would i query all records that were created on i.e. mondays?
[22:51:54] <Boomtime> devguy01: that is a php question, you should try in #php - however, you should be using trim not str_replace
[22:52:20] <okapi> i see how i would query for a timerange but i google didnt give me any indication as to how i would just generally go about for such a query
[22:53:56] <Boomtime> okapi: you could use aggregation: http://docs.mongodb.org/manual/reference/operator/aggregation/dayOfWeek/
[22:54:28] <devguy01> its just werid how its changed all the sudden i haven'
[22:54:30] <Boomtime> however, you want to make sure you do a $match before that $project or you'll end up walking the entire collection which would be unindexable
[22:54:32] <okapi> lets have a look at that. thx :)
[22:54:34] <devguy01> I haven't added any code
[22:54:39] <devguy01> i Hate it when that happens
[23:07:05] <okapi> aggregate would have been a great option but i am using mongodb with meteorjs which doesnt support aggregate
[23:07:23] <okapi> is there maybe another way to do this?
[23:07:50] <Boomtime> don't use meteorjs?
[23:08:15] <okapi> little too far down the road for that :P
[23:09:31] <Boomtime> you are asking about how to do a particular query you need, but you've already made fundamental design choices that prevent you from accessing that ability?
[23:10:02] <Boomtime> aggregation is the way to do it with preexisting data
[23:10:18] <Boomtime> you can modify your data instead to have a "day of week" fielkd
[23:10:28] <Boomtime> then you can simply query on that
[23:11:53] <Derick> okapi: does meteorjs support commands? if it does, you can use that to use aggregations
[23:13:20] <okapi> Boomtime: day of week field might be a good idea. didnt think of that stupidly. so obvious ...
[23:13:27] <okapi> Derick: not sure gonna have to research that tbh