PMXBOT Log file Viewer

Help | Karma | Search:

#mongodb logs for Friday the 5th of June, 2015

(Back to #mongodb overview) (Back to channel listing) (Animate logs)
[01:16:23] <Thinh> anyone here have success with mongo-connector and hosted solutions like compose.io?
[03:49:39] <acidjazz> totally strange.. for some reason in my setup all dates that I create in mongodb are 18 hours old
[04:06:56] <joannac> acidjazz: server time is off?
[04:11:26] <n0t1me> hello
[04:12:26] <n0t1me> i recently tried building the cxx driver but failed due to it requiring the c driver 1.0 although the quickstart guide says it requires 1.2
[04:12:47] <n0t1me> is this the right place to ask?
[04:17:11] <acidjazz> joannac: tahts what i assume.. unforunately this setup i'm using mongolab.com so i cant really tell
[06:33:37] <hypermist> i can't add an account with db.adduser. it says password cannot be blank but its not blank
[06:55:14] <hypermist> can i have some help on trying to fix it
[06:55:39] <joannac> hypermist: paste what you're trying to do
[06:56:01] <joannac> hypermist: including db.version()
[06:56:09] <hypermist> db.addUser({user:"testnet",pwd:"",roles:["readWrite"]});
[06:56:09] <hypermist> obviously i took out the password
[06:56:28] <hypermist> 2.0.6
[06:56:28] <hypermist> . i think the apt-get install is a bit out of date
[06:56:32] <joannac> dude
[06:56:38] <joannac> upgrade
[06:56:48] <hypermist> i just installed it today via apt-get install mongodb
[06:56:49] <hypermist> lol
[06:56:59] <hypermist> so thats telling me thats way out of date
[06:57:23] <joannac> yes
[06:57:41] <joannac> I don't even know what the syntax is in that version
[06:58:32] <hypermist> how do i een install the updated vers
[06:58:42] <joannac> fidn the install docs for your OS
[06:59:01] <joannac> http://docs.mongodb.org/master/administration/install-on-linux/
[07:01:07] <hypermist> lol i followed it and it wont install it says cannot find mongodb-org
[07:01:34] <joannac> hypermist: pastebin your isntall steps
[07:01:48] <hypermist> http://docs.mongodb.org/master/tutorial/install-mongodb-on-debian/ i followed that tutorial
[07:02:19] <joannac> hypermist: pastebin your install steps
[07:02:33] <hypermist> its exactly the same as whats on there
[07:02:34] <hypermist> >_>
[07:02:50] <joannac> hypermist: patebin your isntall steps *including output*
[07:03:15] <hypermist> what output. it didn't even me an output when i did the last command
[07:05:24] <joannac> so when you ran sudo apt-get update you got no output?
[07:05:38] <joannac> because I find that very hard to believe
[07:05:40] <hypermist> you need to specificy next time. Lol
[07:06:43] <hypermist> http://pastebin.com/SLtHWf39
[07:07:29] <joannac> hypermist: okay, since you don't seem to be getting it: there are 4 steps on that page. I want to see the output of all 4 steps
[07:07:53] <hypermist> you just said the output of update ._.
[07:08:14] <joannac> no i didn't. i said "install steps"
[07:08:16] <hypermist> expect duplicates in the pastebin
[07:08:37] <hypermist> http://pastebin.com/LB2ZF7kd
[07:10:24] <joannac> wait, are you on a 32-bit system?
[07:10:37] <hypermist> i dont know lol
[07:11:45] <joannac> output of 'uname -a' ?
[07:12:13] <hypermist> Linux hypermistwp2 2.6.32-37-pve #1 SMP Wed Mar 18 08:19:56 CET 2015 i686 GNU/Linux
[07:12:48] <joannac> that's 32-bit
[07:13:10] <hypermist> i didnt know lol. i just asked the person to create the vm
[07:13:39] <joannac> okay
[07:13:51] <joannac> pretty sure there are no 32-bit packages anymore
[07:14:26] <hypermist> well damnit. well looks like i cannot do what i wanted to then.
[07:14:33] <joannac> are you jsut testing? you're not going to get very far
[07:14:44] <joannac> 32-bit is limited to 2gb of data
[07:14:55] <hypermist> I wwasnt testing
[07:15:15] <joannac> okay
[07:15:26] <joannac> well I can link you on how to install 32-bit mongodb
[07:15:31] <hypermist> that'll be nice
[07:15:43] <joannac> but if you're using it for something serious, you should jsut get a 64-bit machine or VM
[07:15:56] <hypermist> Dont have the $
[07:16:23] <joannac> okay
[07:16:32] <joannac> so you're okay with maximum of 2gb data?
[07:16:54] <hypermist> should be fine yes
[07:17:01] <hypermist> if not i'll have to sort out a deal
[07:17:02] <hypermist> xD
[07:17:04] <joannac> https://www.mongodb.org/downloads and select "linux 32-bit"
[07:22:57] <hypermist> lol well that 100% didn't work after even following the steps
[07:23:54] <joannac> how so?
[07:24:29] <hypermist> http://pastebin.com/cKn4kx3k
[07:25:13] <joannac> well, is there a mongod instance already running?
[07:25:30] <hypermist> i killd it before
[07:25:37] <hypermist> and then did mongod again and it said the same error
[07:25:51] <hypermist> and its not even running right now
[07:26:01] <joannac> is there anything in /data/db that you want to keep?
[07:26:08] <hypermist> its empty
[07:26:14] <joannac> no it's not
[07:26:18] <hypermist> havent been able to start my project
[07:26:20] <joannac> for a start, mongod.lock is there
[07:26:36] <hypermist> well. okay yea there is some stuff there but nothing thats to do with me
[07:26:45] <joannac> ...then whose is it?
[07:26:56] <hypermist> -.-. im meaning my own project stuff
[07:27:25] <joannac> is this your machine? if you delete all that data, is someone else going to be mad?
[07:27:33] <hypermist> nope nones going to be mad
[07:27:36] <joannac> okay
[07:27:43] <joannac> then delete everything in that folder and try again
[07:28:46] <hypermist> lol didn't work
[07:30:01] <joannac> hypermist: logs?
[07:30:16] <hypermist> where do i find that
[07:30:21] <joannac> hypermist: it would be really helpful if you would just pastebin, rather than making me ask every time
[07:30:35] <joannac> I dunno, what didn't work? how do you know it didn't work?
[07:30:39] <joannac> that would be a good start
[07:31:01] <hypermist> sorry for being a dumbass and asking for help....
[07:31:19] <hypermist> http://pastebin.com/LZzAvB5y
[07:31:53] <joannac> output of 'ls -la /data/db' please
[07:32:26] <hypermist> hypermist@hypermistwp2:~$ ls -la /data/db
[07:32:26] <hypermist> total 8
[07:32:26] <hypermist> drwxr-xr-x 2 root root 4096 Jun 5 07:27 .
[07:32:27] <hypermist> drwxr-xr-x 3 root root 4096 Jun 5 07:27 ..
[07:32:34] <joannac> it's owned by root
[07:32:38] <joannac> you're not running as root
[07:32:47] <hypermist> no im not
[07:32:52] <joannac> hence the permissions errors
[07:33:03] <hypermist> lolwow
[07:33:05] <joannac> either change the permissions, run as root, or run with a different dbpath
[07:34:00] <hypermist> heh i can look at my mongod via internet
[07:34:18] <hypermist> how to disable that one
[07:37:29] <joannac> ...what?
[07:37:30] <hypermist> lol it says ** WARNING: You are running in OpenVZ. This is known to be broken!!!
[07:37:31] <hypermist> thats nice to know ;(
[07:43:05] <hypermist> how do i create a db. joannac when i do use explorerdb, nothing responds
[07:47:39] <joannac> hypermist: "nothing responds" -> means what? the shell hangs?
[07:47:55] <hypermist> THere is just no response from when i do the cmd
[07:48:17] <joannac> why should there be?
[07:48:33] <hypermist> well how the hell am i meant to create a db if i responds to nothing i say
[07:48:47] <joannac> pastebin please
[07:49:33] <joannac> when I type "use mydb" in the shell, I get "switched to db mydb". what do you get?
[07:49:45] <hypermist> nothing
[07:49:50] <hypermist> its blank
[07:49:52] <hypermist> no response
[07:50:11] <joannac> the terminal that you started mongod on, what does that say?
[07:50:47] <hypermist> http://pastebin.com/bfFYZCrz
[07:51:21] <acidjazz> ll my date issue was my VM
[07:51:57] <joannac> hypermist: okay, the the terminal that you typed "use mydb" on, what's the full output?
[07:52:46] <hypermist> i was doing it inside of the mongod process was i not meant to ?
[07:52:50] <joannac> no
[07:53:02] <joannac> are you following a tutorial or something?
[07:53:07] <hypermist> no
[07:53:10] <joannac> because you should
[07:53:34] <hypermist> well it shouldn've been so hard. lol
[07:53:43] <hypermist> cause my friends using the exact same software
[07:53:53] <hypermist> and is got it going fine mind you this is 64bit his system
[07:54:08] <joannac> https://docs.mongodb.org/getting-started/shell/client/
[07:56:00] <hypermist> could've told me that earlier; |
[07:57:17] <hypermist> lol it still says my ver is 2.0.6 when i did the mongo thing
[07:57:52] <joannac> you downloaded the tarball, right?
[07:58:11] <joannac> go to that folder and run the executable inside that folder
[08:00:02] <hypermist> lol in the dir. of the new mongo db
[08:00:12] <hypermist> 2.0.6 when i do db.version()
[08:02:38] <joannac> hypermist: seriously. start again.
[08:02:45] <joannac> uninstall the old package you have
[08:02:55] <joannac> go the that link I gave you and start from the beginning
[08:02:55] <hypermist> i did apt-get remove mongodb
[08:04:06] <joannac> I don't think you actually understand how a database works. so follow the tutorials and it should at least get you up and running
[08:04:27] <joannac> you're going to be fighting an uphill battle on a 32-bit host though
[08:06:56] <Dev0n> hey, anyone know if there is anything that would allow you to use mongodb query on a standalone object that's not currently in mongo?
[08:07:18] <Dev0n> something like doc = Object; .find({...}, doc)
[08:10:08] <Dev0n> one hacky way to do it is insert it then do find on the id that you get back for that document
[08:14:42] <Dev0n> humm, this looks promising: https://github.com/mcvella/mongo-json-query
[10:11:05] <hypermist> joannac, i have it working on 3.0.3
[10:11:08] <hypermist> question is though
[10:11:17] <hypermist> i have it running mongod
[10:11:33] <hypermist> and it says waiting for connectings but when i goto connect my program it goes unable to connect
[10:48:06] <hypermist> My thing wont connect to the db
[11:36:10] <milestone> hi folks, can someone tell me what happened to the find_one method of the ruby mongo driver for 2.6?
[11:36:28] <milestone> in mongo 2.0.4 this is no longer available
[11:36:35] <hypermist> well i think i have to upgrade to 64bit os.. :\
[11:36:36] <milestone> has this been replaced by an equivalent?
[11:36:56] <hypermist> cause if i dont upgrade to 64bit. since its not actually installed as a process or maybe i need to reboot
[12:22:40] <flok420> I have a collection with millions of documents. each has a ts and a value. now I would like to know the maximum and minimum ts (not the value) for all documents where ts older than x. how can i do that quickly? I tried using collection.group(...) but that takes ages
[12:25:17] <hypermist> lol i cannot make my program connect to the db
[12:27:48] <cheeser> flok420: use an aggregation
[12:28:29] <hypermist> Unable to connect to database:, is this because im using the 32bit
[12:28:58] <cheeser> it's unlikely that 32 bitness is the problem.
[12:29:11] <hypermist> but the info is correct
[12:29:26] <cheeser> telnet to your port and see if anything is listening
[12:30:01] <hypermist> unknown host
[12:30:09] <cheeser> there you go. dns problems.
[12:30:11] <hypermist> cause i was looking at it when i booted it. it'd say 0.0.0.0
[12:35:08] <flok420> cheeser: would that be something like the following because that still takes minutes on a very small dataset: db.data2.aggregate([ { $match : { 'ts' : { '$lt' : 1433402642 } } }, { $group : { _id : "$ts", max_ts : { $max : "$ts" } } } ])
[12:35:16] <hypermist> http://pastebin.com/bbJZ5u2J cheeser
[12:35:25] <hypermist> it says failed to identify for testnet
[12:35:31] <hypermist> But. those passwords = correct
[12:36:20] <cheeser> flok420: possibly
[12:38:13] <flok420> cheeser: I'm also not sure about that $group : { _id : "$ts", why does it need that _id? I don't care for the_id, I only want to know that max_ts
[12:38:41] <cheeser> i think documents coming out of a group need *some* _id.
[12:38:50] <cheeser> i could be wrong, though. i don't work much with aggregations directly.
[12:38:56] <hypermist> cheeser, can you help me at all
[12:39:12] <cheeser> hypermist: only what i've done so far.
[12:39:20] <hypermist> ?
[12:39:33] <cheeser> you can't telnet to it because you get unknown host. so it sound like you need to fix dns or your connection string.
[12:39:45] <hypermist> its locally
[12:40:09] <hypermist> so 127.0.0.1 or localhost
[12:42:06] <cheeser> so why would you get "unknown host" when telnetting?
[12:42:12] <hypermist> dont know
[12:43:57] <hypermist> actually i done the telnet wrng
[12:44:05] <hypermist> i did localhost:27017
[12:44:11] <hypermist> not localhost 27017
[12:44:14] <hypermist> and it connected
[12:45:36] <hypermist> it keeps saying authentication failed cheeser but i know the password is correct
[12:46:32] <cheeser> ah, i've never worked with auth really. you might need to specify the authDB but you'll need to check the docs about that one.
[13:43:27] <Zelest> Is it possible to sort a find() based on the number of elements in an array?
[15:17:15] <pamp> what about verion control for mongodb databases?
[15:17:41] <pamp> any tool available?
[15:19:32] <StephenLynx> uh?
[15:19:36] <StephenLynx> what do you mean, pamp?
[15:35:27] <Bilge> I guess he needs to version control the nonexistent schema
[15:35:53] <StephenLynx> :v
[15:39:30] <FanBoy> Has anyone got Edda running in the last year? Tried it in Windows, colleague tried it in MacOS
[15:40:09] <FanBoy> various errors are thrown in the script.
[15:40:47] <FanBoy> and I have tried installing it from pip as well as from the latest in github
[15:41:41] <StephenLynx> what is edda?
[15:42:22] <FanBoy> http://blog.mongodb.org/post/28053108398/edda-a-log-visualizer-for-mongodb
[15:42:33] <FanBoy> and IIRC its at the top of the tools list on the MongoDB site
[15:43:07] <StephenLynx> looks bad, IMO.
[15:43:44] <StephenLynx> who in their right mind would take so much time in visual design for a tool like this?
[15:45:09] <FanBoy> its good for learning and teaching MongoDB, as well as demos
[15:46:06] <StephenLynx> meh
[15:46:20] <StephenLynx> btw
[15:46:24] <StephenLynx> did you try in linux?
[15:46:32] <StephenLynx> since, you know, its a working tool.
[15:46:35] <StephenLynx> for working purposes.
[15:47:00] <StephenLynx> only makes sense you try to use it in a working OS
[15:49:17] <cheeser> it was an intern project. cut 'em some slack.
[15:49:34] <FanBoy> OS fanboyism is ironcially lost on me, I honestly don't care what OS you use if it works for you :)
[15:50:20] <StephenLynx> well, obviously neither windows or osX worked on you :^)
[15:50:35] <FanBoy> cheeser: its a good looking app (from the screenshots anyway)!
[15:50:52] <StephenLynx> good looking isn't productive.
[15:51:47] <FanBoy> and yet my girlfriend is quite good at housework
[15:52:56] <StephenLynx> not because of her looks.
[15:53:14] <FanBoy> as mentioned, it would nice as an educational tool or for demos. Perhaps you've never had to try and sell something to a client, but sadly it is often style over substance
[16:11:00] <SpeakerToMeat> Yes this is the last channel of the kit
[16:57:12] <ams__> I'm trying to speed up my mongodb upserts. Are upserts likely to be slower than straight replaceOnes? Are there any metrics anywhere I can take a look at?
[16:58:56] <StephenLynx> How much longer are they taking?
[17:02:46] <ams__> I've not doing comparisons myself, I'm being lazy and wondering if anyone else has already done them for me
[17:04:52] <StephenLynx> http://stackoverflow.com/questions/22354246/mongo-upsert-performance-c
[17:31:13] <greyTEO> GothAlice, I haven't forgotten about releasing the php library for marrow.task. I have been jumping around projects lately
[17:31:24] <GothAlice> No worries.
[17:31:34] <greyTEO> How is that coming along?
[17:31:53] <GothAlice> Large deployment at work redirected some effort, but it's coming along quite nicely, actually.
[17:32:00] <greyTEO> I see the build tags are still invalid
[17:32:08] <GothAlice> https://github.com/marrow/task/network
[17:32:23] <GothAlice> Most of the work is happening in a fork. There'll be a pull request at the end of that.
[17:32:43] <GothAlice> Heh… I hope you can see the deKross fork, there. ¬_¬
[17:33:18] <greyTEO> Yea I see it
[17:33:44] <greyTEO> that's awesome. Im still keeping eyes on it
[17:34:49] <GothAlice> It's a little http://s.webcore.io/image/310Y3X3b1k1Q at the moment, unfortunately. Fun to debug, though. ^_^
[17:36:04] <greyTEO> Just a heads up, your contact link on your company website doesn't work
[17:36:15] <greyTEO> About Us >> Contact us
[17:37:22] <greyTEO> "en" that is
[17:38:19] <greyTEO> lol those are always a pleasure
[17:47:57] <ams__> mongostat is reporting between 0 and 15 faults. Is non-0 always bad?
[17:48:17] <StephenLynx> by fault I think it might be pagefault.
[17:48:31] <StephenLynx> if I am not mistaken, that is when it has to look for something on the disk.
[17:48:33] <StephenLynx> but I am not sure.
[18:08:12] <GothAlice> ams__, StephenLynx: Correct, a page fault is MongoDB reading data from disk that was loaded before, but had been "paged out" (removed from the in-memory cache).
[18:08:30] <GothAlice> Well, regardless of having been loaded before. Cold caches will generate a large number of page faults initially.
[18:17:34] <deathanchor> how do I drop a db.system.profile on a secondary?
[18:21:47] <deathanchor> is there a way to drop a collection on a secondary?
[18:31:05] <brotatochip> cheeser and deathanchor so I've decided to move forward with the 3 DC option with an arbiter and it seems to work well with my forced failover/failback tests. What I'm doing is setting the prod primary priority to 10, DR site to 1, so the failover is warm in the event of DC outage
[18:31:52] <brotatochip> then what I'm doing is going to the DR site (now primary) reconfig its priority to 10 and the prod priority to 1 so that when it comes back up it isn't elected as primary, and this works
[18:32:36] <brotatochip> Then I'll bring the app down in DR, wait for the sync to complete from DR to PROD secondary, then reconfiguring back to original - DR site priority 1 PRD 10, then prod gets elected as primary again
[18:33:01] <deathanchor> you don't have to change both priorities
[18:33:09] <deathanchor> just set the DR one to 20
[18:33:14] <deathanchor> then back to 1
[18:33:18] <brotatochip> oh, right, I could just set DR to 100, and then drop it back to 1 after it completes the sync
[18:33:24] <brotatochip> or 20
[18:33:30] <deathanchor> yeah whatever floats your boat
[18:33:37] <brotatochip> thanks deathanchor, do you see any other issue with this config?
[18:33:56] <deathanchor> your apps should know about all members of the set
[18:34:16] <deathanchor> so whenever a new primary is elected the apps just automatically go there
[18:34:35] <brotatochip> I don't think they should, because I have one set of app servers in Prod and one set in DR, and they only need to reach the DB that is local to them when that is a primary
[18:35:00] <brotatochip> I'm using route 53 to direct traffic flow
[18:35:39] <brotatochip> in the event of a DC outage in prod, I'll either set up hot failover for route 53 to point to DR instead, or manually do it
[18:36:59] <deathanchor> just saying if you want automatic app switching: http://docs.mongodb.org/meta-driver/latest/legacy/connect-driver-to-replica-set/
[18:38:16] <deathanchor> sorry, this is better: http://docs.mongodb.org/manual/reference/connection-string/
[18:38:17] <brotatochip> basically if there's a DC outage, it doesn't matter what the app is pointing to because the app is down in prod, so DR will be spun up to point to the DR mongodb instance, I don't think currently my use case needs automatic app switching
[18:39:06] <brotatochip> thanks for that though deathanchor that will definitely prove useful if and when we need to scale mongodb horizontally
[18:41:00] <deathanchor> so I still need help with profiler.. how do I drop the db.system.profile on a secondary where I ran the profiler?
[18:41:04] <brotatochip> also deathanchor I've decided to implement a hidden slave for backups thanks to your advice
[18:41:28] <brotatochip> don't want to impact prod and I want to be able to take regular backups - both mongodumps and snapshots
[18:43:06] <brotatochip> oh btw does anybody know if there is a way to have secure encrypted communication for mongodb 2.6 without compiling the binary myself?
[18:43:15] <deathanchor> SSL?
[18:43:28] <brotatochip> would save quite a bit of overhead from my setup if I can do that
[18:43:34] <StephenLynx> I remember an issue with SSL in old versions, but it was a bug, if I am not mistaken.
[18:43:34] <deathanchor> use SSL
[18:43:40] <StephenLynx> don't know which versions it affected.
[18:43:44] <brotatochip> SSL requires a custom compile based on what I've read deathanchor and StephenLynx
[18:43:56] <deathanchor> no way
[18:43:57] <Derick> iirc, 3.0 has ssl in the binaries
[18:43:59] <brotatochip> for 2.6
[18:44:10] <Derick> (and 2.6 did not)
[18:44:14] <brotatochip> yeah, 3.0 does, but I can't run that in prod yet for several reasons
[18:44:24] <StephenLynx> several reasons: you don't want.
[18:44:27] <Derick> then you'll have to compile
[18:44:43] <brotatochip> also don't want to run custom compiled binaries in prod as they are such a pita to maintain without something like FPM
[18:44:53] <StephenLynx> lol
[18:45:01] <brotatochip> no StephenLynx, it's not ultimately my decision either
[18:45:28] <brotatochip> although I do have a very healthy aversion to not running code that hasn't been out in the wild for at least 6 months to a year
[18:45:38] <brotatochip> s/to not/to/g
[18:46:44] <brotatochip> the CTO and the director of ops (both of my bosses) share that same aversion, and we don't exactly have a timetable for being able to test our social platform with mongodb 3.0
[18:46:46] <deathanchor> So no answers for how to drop the db.system.profile on a secondary where I ran and stopped the db profiler?
[18:57:23] <brotatochip> Derick: what about username/pw auth?
[18:57:47] <brotatochip> would that work for replication?
[18:58:07] <brotatochip> and if so, are those credentials sent in plaintext? (this would defeat the purpose for me)
[19:28:35] <Derick> brotatochip: auth is not encrypted, you need ssl for that
[19:34:21] <n0t1me> is there anybody here able to help me build the mongodb-cxx-driver master?
[19:37:10] <crised_> When you use java with mongodb, Do you normally use GSON to convert POJO to JSON?
[19:44:20] <brotatochip> yeah I thought so Derick, that's unfortunate :/
[19:51:35] <crised_> if mongodb uses bson internally, as a app developer, why would I care about this?
[19:53:01] <Derick> crised_: you don't need to
[19:54:24] <Zelest> Derick, i wrote a little thingie to handle translations.. so i basically have an object with the fields en, sv, de, etc for each language.. The page writes the text on english and i wrap the text around this function.. if the text is found in "en", replace it with whatever language the user has picked.. if available..
[19:54:44] <Zelest> Derick, however, i've noticed that texts that contains a lot of spaces isn't found. :o
[19:54:59] <Zelest> as in, returns, spaces, tabs.. (some of the text is formatted)
[19:55:12] <Zelest> (using the php driver)
[20:03:45] <Derick> Zelest: that sounds odd... you sure they're not non breaking spaces or similar types of line endings?
[20:04:09] <Zelest> not entirely sure tbh..
[20:04:19] <Zelest> i did an ugly hack that replaces them all though
[20:04:41] <Zelest> trim(preg_replace('/\s+/', ' ', $string)) :P
[20:04:50] <Zelest> and there goes irccloud :S
[20:05:04] <Derick> let me know if you have a reproduce script - happy to have a look then
[20:06:33] <Zelest> will do :)
[20:07:54] <crised_> Is it a good practice to use the default ObjectId Primary key?
[20:10:46] <Derick> if you have your own unique key already, use that
[20:10:47] <crised_> every mongodb document MUST be valid json right?
[20:11:05] <Derick> crised_: depends... on the language driver
[20:11:13] <Derick> from PHP, you won't ever see JSON
[20:11:28] <crised_> Derick: Will be using Java/Javascript and mongodb shell
[20:11:45] <Derick> the shell is a bit more lenient as to what javascript it accepts
[20:11:54] <Derick> from java, you'd be using DBObjects iirc
[20:12:17] <crised_> Derick: how do I extract the 4 byte vlue representing the seconds since Unix epoch?
[20:12:28] <Derick> on the shell?
[20:12:40] <crised_> Konsole output "_id" : ObjectId("557200d4f6d0202adfb5de8c")
[20:12:43] <crised_> Derick: yes
[20:12:50] <crised_> is 55 the first byte?
[20:12:57] <Derick> yes
[20:12:59] <crised_> is the decimal?
[20:13:04] <Derick> no, it's hex
[20:13:15] <Derick> > a = new ObjectId("5571fb4fb8c96e12300bedf1")
[20:13:15] <Derick> ObjectId("5571fb4fb8c96e12300bedf1")
[20:13:15] <Derick> > a.getTimestamp()
[20:13:15] <Derick> ISODate("2015-06-05T19:41:03Z")
[20:14:05] <crised_> Derick: awesome
[20:14:28] <crised_> so... I don't need to define any scheme?
[20:14:35] <Derick> correct
[20:14:37] <crised_> How would I define a primary key if I don't want to use default?
[20:14:40] <crised_> that's awesome
[20:14:57] <Derick> crised_: just insert it: db.colname.insert( { _id: "myid" } );
[20:15:34] <n0t1me> anybody know how to build the current cxx-driver?
[20:16:42] <diegoaguilar> Hello, anyone experienced with mongoose?=
[20:16:54] <crised_> Derick: cool
[20:17:12] <diegoaguilar> Hello, I'm trying to use mongoose to perform queries and db logic ... however I got an issue as any model seems to get find, findById, etc methods available ... this is what my code looks like
[20:17:27] <diegoaguilar> Hello, I'm trying to use mongoose to perform queries and db logic ... however I got an issue as any model seems to get find, findById, etc methods available ... this is what my code looks like
[20:17:29] <diegoaguilar> http://www.hastebin.com/elifecoyuy.js
[20:17:32] <crised_> Derick: is there a need to define the attribute names?
[20:17:50] <crised_> Derick: I meant the columns name, but they are already defined in json....
[20:18:29] <Derick> no need to define anything
[20:20:47] <crised_> I see
[20:26:14] <crised_> Derick: How do I define a coordinate in mongodb? Do I need to define it as a column name?
[20:29:27] <Derick> a coordinate? like lat/long?
[20:29:34] <crised_> Derick: yes geopoint
[20:29:42] <Derick> you'd store that like this:
[20:30:33] <Derick> db.colname.insert( { _id: 'yourid', 'location' : { 'type': 'Point', 'coordinates' : [ long, lat ] } } );
[20:30:34] <crised_> Is a (x,y) a number or array data type_
[20:30:36] <Derick> ie:
[20:30:52] <Derick> db.colname.insert( { _id: 'yourid', 'location' : { 'type': 'Point', 'coordinates' : [ -0.5, 59.5 ] } } );
[20:31:01] <Derick> and then, to do geo queries on it, use:
[20:31:13] <Derick> db.colname.createIndex( { location: '2dsphere' } );
[20:31:57] <crised_> Derick: so the coordinate is not either Number or Array, it's a special data type called 'Point'?
[20:32:26] <Derick> yeah, it's geojson: http://docs.mongodb.org/manual/reference/geojson/
[20:32:51] <crised_> Derick: that automatically is an index?
[20:32:55] <crised_> a secondary index?
[20:33:04] <Derick> you need to create the index with createIndex
[20:33:09] <Derick> but yes, that's a secondary index
[20:33:20] <Derick> "2dsphere" is a special index for geospatial data
[20:34:03] <crised_> Derick: so I don't need to createIndex, I will de using default _id and coordinates
[20:34:19] <crised_> but I want to query things like give me points close to (lat,long)
[20:34:28] <Derick> you need the createIndex
[20:34:35] <crised_> What for?
[20:34:42] <Derick> you make it on the "location" field
[20:34:45] <crised_> I don't really get the Index stuff
[20:34:51] <Derick> MongoDB needs to know what field you create an index on
[20:34:53] <crised_> One create indexes, so queries are faster
[20:34:55] <crised_> ?
[20:34:55] <Derick> just like in SQL
[20:35:08] <Derick> yes, and for geospatial queries, that index is *required*
[20:35:37] <crised_> oh I get it, createIndex is done here: db.colname.createIndex( { location: '2dsphere' } );
[20:35:41] <Derick> yes
[20:35:57] <crised_> why db.colname? Where is collectionName?
[20:36:05] <Derick> db.collectionName.createIndex
[20:36:09] <Derick> i just shortened it
[20:36:20] <crised_> oh I was confusing with columns, really dumb myself
[20:36:54] <Derick> I got to go now though
[20:36:55] <Derick> good luck
[20:37:21] <crised_> Derick: thanks!! appreciate your help
[20:37:53] <Derick> np
[20:39:39] <crised_> Derick: Why did you change save to insert?
[20:40:18] <crised_> When to use ' or ""
[20:47:11] <gagalicious> i'm about to convert to cassandra, not trying to start a flame war here... but can anyone advise what's mongo doing better than cassandra? and how does the storage efficiency of mongo compares with tokudb?
[20:48:39] <StephenLynx> absolutely no idea about anything about cassandra and never heard about tokudb
[20:49:39] <StephenLynx> http://www.infoworld.com/article/2848722/nosql/mongodb-cassandra-hbase-three-nosql-databases-to-watch.html
[20:49:46] <StephenLynx> " Cassandra earns full marks for being easy to manage at scale."
[20:51:10] <StephenLynx> from what this guy says, it seems cassandra its more streamlined.
[20:51:43] <StephenLynx> and tokudb seems to be something you use on top of mariadb.
[20:51:53] <StephenLynx> so I am not even going to bother getting the details.
[20:57:58] <gagalicious> ...
[21:14:30] <diegoaguilar> Can anyone help me with a mongoose issue? https://stackoverflow.com/questions/30675729
[21:56:38] <crised_> When working in Java, How do you validate the structure of the json document inserted?
[22:17:32] <MacWinner> if I have a document like invoice = { notes: 'Test Invoice', products: [ {name: 'product1'}, {name:'product2'}] } is there an atomic way to add another product to the array but only if there is not existing element in the products array with the same name? like if I try adding {name: 'product3'} to products, it should work.. but {name: 'product2'} should not since it's already there.. I want this to be atomic in case 2 different processes
[22:17:32] <MacWinner> are trying to update at the same time.. the first process should win
[23:35:55] <MeStesso> hello! do you know if there’s a way to have MongoDB using SSL and requiring authentication only on a certain network interface or only when the request comes from IPs that are not in the LAN?
[23:37:33] <cheeser> it isn't. you'd need to use a proxy for that.
[23:37:44] <MeStesso> cheeser: what kind of proxy?
[23:37:54] <cheeser> one that does what you just said
[23:38:13] <MeStesso> cheeser: for example?
[23:38:17] <MeStesso> what software?
[23:38:19] <cheeser> ?
[23:38:51] <MeStesso> cheeser: i know nginx is a proxy,but i don’t think i can use it to proxy mongodb… what kind of proxy would work then?
[23:38:58] <cheeser> i dunno
[23:40:12] <StephenLynx> anything that proxies tcp, imo.
[23:40:20] <StephenLynx> since that is what mongo uses.
[23:40:21] <cheeser> and offers auth
[23:40:24] <MeStesso> StephenLynx: also for authentication?
[23:40:38] <StephenLynx> I am not experience with proxies.
[23:40:45] <joannac> how to set up an authenticated proxy is a question you should ask your sysad
[23:40:46] <MeStesso> i can only think of SSH but that would require creating an entire new user with certain privileges i don’t want them to have
[23:41:08] <StephenLynx> but if the peer behind the proxy authenticated, wouldn't the proxy just have to send the server EXACTLY what its receiving from the peer?
[23:41:11] <MeStesso> i can also think of VPN but that requires extra hardware and extra monthly AWS fees. my boss says no
[23:41:33] <cheeser> security isn't free
[23:41:48] <cheeser> you could just do SSL/auth for everyone
[23:42:05] <MeStesso> cheeser: no i can’t,sadly
[23:42:06] <cheeser> that's the absolute simplest way
[23:42:10] <cheeser> sure you can
[23:42:17] <StephenLynx> I can't see why a proxy in the first place
[23:42:35] <joannac> MeStesso: bear in mind the auth would be above the mongod layer.
[23:42:50] <joannac> i.e. the choice would be "no access" or "access to everything in mongodb"
[23:42:54] <MeStesso> joannac: that’s fine
[23:43:08] <MeStesso> the mongod has just one database
[23:44:07] <ChALkeR> What's wrong with enabling auth?
[23:44:30] <MeStesso> ChALkeR: the applications don’t have support for auth in MongoDB and that would require a lot of extra work
[23:44:55] <ChALkeR> A lot?
[23:45:04] <MeStesso> ChALkeR: yeah…
[23:45:15] <ChALkeR> Do you have an own implementation of the protocol?
[23:45:31] <ChALkeR> Or are you using some lib (which one) that does not support auth?
[23:45:34] <cheeser> they don't have support for what? it's a driver/config thing.
[23:46:00] <MeStesso> ChALkeR: look, the developers taking care of mongodb said no auth , they can’t do that
[23:46:08] <MeStesso> i’m not supervising that part so i’m not sure why
[23:46:36] <cheeser> s/can't/won't/
[23:46:44] <joannac> tell them the boss said "no proxy" and let them fight it out
[23:47:06] <cheeser> one side has to give
[23:47:19] <MeStesso> think i’ll go with SSH tunnels
[23:47:20] <ChALkeR> Will they prefer an ssh tunnel?
[23:47:35] <MeStesso> they don’t care about ssh tunnels as that doesn’t impact their code
[23:47:57] <ChALkeR> Auth also doesn't impact their code.
[23:48:06] <ChALkeR> As long as they use a connection string.
[23:48:16] <MeStesso> not sure what to tell
[23:48:21] <ChALkeR> Or needs just two lines if they don't.
[23:48:25] <MeStesso> anyways, thanks for all the ideas
[23:48:28] <joannac> I would consider ssh tunnels to be a far more complicated scenario to set up
[23:48:32] <joannac> but good luck
[23:49:00] <MeStesso> thanks!
[23:49:07] <cheeser> and doesn't solve the auth question
[23:49:26] <ChALkeR> Also, I recommend configuring your firewall to block everything, except for the desired subnetworks. As as _additional_ measure.
[23:50:29] <MeStesso> ChALkeR: that’s already being done :)
[23:50:35] <MeStesso> using AWS security groups
[23:50:47] <ChALkeR> Ok.
[23:54:02] <ChALkeR> MeStesso: What mongodb client library do you use, btw?
[23:54:07] <ChALkeR> Ah, he left.
[23:58:42] <ChALkeR> And mongo-ruby-driver to 1.12.3
[23:59:35] <ChALkeR> Btw, did they make a public announcement on that one?
[23:59:41] <ChALkeR> Or was it just a silent release>
[23:59:43] <ChALkeR> ?