These are chat archives for FreeCodeCamp/Help

12th
Mar 2015
Suzanne Atkinson
@AdventureBear
Mar 12 2015 14:11
question... I'm doing aa few MEAN tutorials from the scotch.io website.
rather than having several different tiny projects I want to build and slightly modify (ie my bears with things to do app).
So can I add to my package file then simple rerun npm install as I go? Just adding packages when I need?
2nd question...in my models, if they change, I only have to update the model, I don't have to rebuild a schema like if I were using rails?
Cristián Berríos
@crisberrios
Mar 12 2015 14:30
good morning Suzanne
Suzanne Atkinson
@AdventureBear
Mar 12 2015 14:31
good morning Cris!
Cristián Berríos
@crisberrios
Mar 12 2015 14:31
yeah, just install modules with --save and they will be in your package.json
about models, what models, mongoose models?
Suzanne Atkinson
@AdventureBear
Mar 12 2015 14:32
yes mongose models
Cristián Berríos
@crisberrios
Mar 12 2015 14:32
well, schema and model are fairly interlinked
Suzanne Atkinson
@AdventureBear
Mar 12 2015 14:32
the tutorial builds thepackage.json file first then just runs npm install. So it can work either wiay? (ie if I do npm install 'somepackage' --save it will be added and installed
Cristián Berríos
@crisberrios
Mar 12 2015 14:33
yes
Suzanne Atkinson
@AdventureBear
Mar 12 2015 14:33
ok, maybe I'm not asking about the models in the right way
/**
 * Created by suzanne on 3/11/15.
 */
// app/models/bear.js

var mongoose     = require('mongoose');
var Schema       = mongoose.Schema;

var BearSchema   = new Schema({
    name: String
});

module.exports = mongoose.model('Bear', BearSchema);
if I want to add new fields to bear, I just add them here? and they they will be available?
Evan Davis
@davisec52
Mar 12 2015 14:45
Good morning. I'm working on the bonfire challenge sumFibs and do
not understand why the code sample below is not passing. It passes
on the input of 1 and 4 and on repl.it appears to give the
correct result for 1000 and returns infinity for all the other
bonfire tests. I'd appreciate any help and insight.

function sumFibs(num) {
    var list = [];
    list[0] = 0;
    list[1] = 1;
    if(num <= 0) {
        return 0;
    }
    else if(num <= 2) {
        return 1;
    }
    for(var i =2; i <= num; i++) {
        list[i] = list[i - 1] + list[i - 2];
    }
    var finalSum = list.filter(function(a) {
        if(a % 2 !== 0) {
            return a;
        }
    }).reduce(function(a, b) {return a + b;});

    return finalSum;

}
//sumFibs(4);         //=> 5
//sumFibs(1);         //=> 1
//sumFibs(1000);       //=> 11708364174233842
//sumFibs(4000000);   //=> Infinity
sumFibs(75024);        //=> Infinity
Cristián Berríos
@crisberrios
Mar 12 2015 14:49
@AdventureBear yes, just add them there and it's all ready
 var finalSum = list.filter(function(a) {
        if(a % 2 !== 0) {
            return a;
        }
Suzanne Atkinson
@AdventureBear
Mar 12 2015 14:52
yippee. my bears are going fishing.
Cristián Berríos
@crisberrios
Mar 12 2015 14:52
you could express that as
return a%2
Evan Davis
@davisec52
Mar 12 2015 14:53
@crisberrios hi, cris.
any idea why it is not passing the tests?
Cristián Berríos
@crisberrios
Mar 12 2015 14:55
let me check on repl.it
Evan Davis
@davisec52
Mar 12 2015 14:55
Sorry, I should have created a link.
Cristián Berríos
@crisberrios
Mar 12 2015 14:58
I think it's the fibs "up to num" not "num first fibs"
have you checked that?
Evan Davis
@davisec52
Mar 12 2015 14:59
@crisberrios not sure what you mean.
Cristián Berríos
@crisberrios
Mar 12 2015 14:59
the input
is it the number of fibs
or the upper limit for the number
since in your algorithm you generate the 1st n fibs using num as limit
Evan Davis
@davisec52
Mar 12 2015 15:00
the sum is to include the input if it is a fib number
the sum of all odd fib numbers up to and including the input if the input is a fib.
Cristián Berríos
@crisberrios
Mar 12 2015 15:01
ok
up to the number
not all number of fibonaccis
you are getting it backwards I think
so if you input 10
it's not the 1st 10 fibs
it's just 0,1,1,2,3,5,8
Evan Davis
@davisec52
Mar 12 2015 15:03
"Return the sum of all odd Fibonacci numbers up to and including the passed number if it is a Fibonacci number."
Cristián Berríos
@crisberrios
Mar 12 2015 15:05
yup, check the wording
Evan Davis
@davisec52
Mar 12 2015 15:15
@crisberrios Ok. Now I understand, or at least I think I do. So, for example, if the input were 12, we would sum an array with the following numbers: [ 0, 1, 1, 3, 5, 8, 13]?
@crisberrios By the way, do know why the code adds 2 to the array with the condition specifies exclusion of numbers divisible by 2?
Cristián Berríos
@crisberrios
Mar 12 2015 15:17
not 13 since it's greater than the input
Evan Davis
@davisec52
Mar 12 2015 15:17
@crisberrios sorry, if the input were 15.
meant to write 15
Cristián Berríos
@crisberrios
Mar 12 2015 15:17
oh it was the odd numbers
my bad
it would only be 0,1,1,3,5
Evan Davis
@davisec52
Mar 12 2015 15:18
If the input is 5, the array we could sum would be: [0 , 1, 3, 5]?
Cristián Berríos
@crisberrios
Mar 12 2015 15:19
yes
well, I'm not sure if 0,1,1,3,5 or 0,1,3,5
it should be 0,1,1,3,5
well
1,1,3,5
since 0 isn't odd either
:P
Evan Davis
@davisec52
Mar 12 2015 15:21
@crisberrios Ok. then I truly do not understand the directions. How in the name of whatever deity you believe in, do you get 0,1,1,3,5 and not 0,1,1,3,5,13?
Is not 13 an odd number?
Cristián Berríos
@crisberrios
Mar 12 2015 15:22
but if my input is 10
13 is greater than 10
Evan Davis
@davisec52
Mar 12 2015 15:22
If the input is 15 as in my example which I typoed at 12 . . .
Cristián Berríos
@crisberrios
Mar 12 2015 15:23
oh sorry
I'm kind of lagged today
if it were 15 then 13 is included
Evan Davis
@davisec52
Mar 12 2015 15:23
No problem. Blood pressure coming down.
Ok. One last question, why does my code add even numbers to the list?
cancel that.
I was console.logging list before the filter.
I think all is well.
Cristián Berríos
@crisberrios
Mar 12 2015 15:25
 var finalSum = list.filter(function(a) {
        if(a % 2 !== 0) {
            return a;
        }
well, in any case filter expects true or false
but a > 0 is always truthy so that should work
it should filter even numbers
Evan Davis
@davisec52
Mar 12 2015 15:26
I think it does. I just need to hammer the code a bit to restrict the list.
Cristián Berríos
@crisberrios
Mar 12 2015 15:26
the problem is in the for loop
not the filter
since the number of fibs is unknown, it would better be represented with a while
Evan Davis
@davisec52
Mar 12 2015 15:28
Yes, that makes sense. Thank you for the hint.
Although, now I'm curious to see how to make it work with for.
Evan Davis
@davisec52
Mar 12 2015 15:42
@crisberrios Thank you! This works and passes using for.

function sumFibs(num) {
    var list = [];
    list[0] = 0;
    list[1] = 1;
    if(num <= 0) {
        return 0;
    }
    else if(num <= 2) {
        return 1;
    }
    for(var i =2; i <= num; i++) {
        list[i] = list[i - 1] + list[i - 2];
    }
    var finalSum = list.filter(function(a) {
        if(a % 2 !== 0) {
            if(a <= num) {
                return a;
            }
        }
    }).reduce(function(a, b) {return a + b;});

    return finalSum;


}
sumFibs(15);
Cristián Berríos
@crisberrios
Mar 12 2015 15:44
it's very inefficient as you generate too many fibs
and add an extra filter
but... it passes
Evan Davis
@davisec52
Mar 12 2015 15:46
@crisberrios one step at a time . . .
Andrew Corcoran
@corca
Mar 12 2015 17:18
Anyone have any recommendations for learning regex besides regexone?
Cristián Berríos
@crisberrios
Mar 12 2015 17:22
hmm I've seen a book recommended
I think it's from safari
Andrew Corcoran
@corca
Mar 12 2015 17:27
I’ll dig around
Meta Hirschl
@MetaCoderHirschl
Mar 12 2015 17:29
@corca this looks like a good summary of intro/resources: http://stackoverflow.com/questions/4736/learning-regular-expressions

this looks good to -- the book is imposing tho (544 pages!): Mastering Regular Expressions is the canonical text. It is how I learned regular expressions and it changed my [programming] life.

When you need to quickly look something up for reference, Regular-Expressions.info is an invaluable resource.

Finally, when you are trying to work out a regular expression, use an online tool that is tailored to the "flavor" of Regex that you are using (.NET, Javascript, Ruby, etc.), or you can purchase standalone apps, such as Regex Buddy (which also helps with learning, though I have not used it personally).

Andrew Corcoran
@corca
Mar 12 2015 17:35
Thanks @MetaCoderHirschl! I scored that book for free a while back but it’s a bit daunting at first. That Stack thread looks super helpful.
Meta Hirschl
@MetaCoderHirschl
Mar 12 2015 17:36
:+1:
Stefan
@worzst
Mar 12 2015 17:45
Hey I’m doing the JS grid on OdinProject and I have a problem which I can’t figure out. The grid and everything works, but after every row there is a margin to the next row. I don’t know how to get rid of it. Devtools didn’t show me any margin or anything too..
I just can’t figure out why it is there, i set margin and everything to 0. And devtools says there is no margin or anything.. But I can see it and it annoys me^^
Meta Hirschl
@MetaCoderHirschl
Mar 12 2015 17:50
are you sure it's not browser re-sizing? I don't see the extra margin to the next row.
Cristián Berríos
@crisberrios
Mar 12 2015 17:50
add line-height: 0 to container
that's one of the caveats of using inline-block
Stefan
@worzst
Mar 12 2015 17:51
@MetaCoderHirschl Not sure, but I have it on Chrome, Safari and Firefox
Meta Hirschl
@MetaCoderHirschl
Mar 12 2015 17:52
--oh sorry @worzst now I see it and the line-height fixed it...ahh. @crisberrios knows his stuff
big plus on the dev tools you can put it and see results, unclick and see without.
Stefan
@worzst
Mar 12 2015 17:53
@crisberrios thx, fixed it :)
really need to remember that
I tried for like 30 mins with everything but I never thought about line-height
Ming Zhang
@Scripore
Mar 12 2015 19:55
how do I go about returning a list of keys of hash objects inside an array?
[{ first: 'Romeo', last: 'Montague' }, { first: 'Mercutio', last: null }, { first: 'Tybalt', last: 'Capulet' }]
Andrew Corcoran
@corca
Mar 12 2015 20:10
@Scripore You would loop through the array and then loop through each object in the array.
Jimmy Bryant II
@JimBry
Mar 12 2015 20:12
Hey everybody, I created a template for a site I'm building out of HTML&CSS now when I try to add an image to to the template its off centered even though the div class name is the same and I assumed it would match up with the CSS .
Was that a bad idea? haha
Andrew Corcoran
@corca
Mar 12 2015 20:16
@JimBry Code samples?
Jimmy Bryant II
@JimBry
Mar 12 2015 20:17
Andrew Corcoran
@corca
Mar 12 2015 20:19
<img class="post-user" src="images/Jeff.jpg" height:>
That’s the image?
Jimmy Bryant II
@JimBry
Mar 12 2015 20:20
Yes, that is sorry I didn't indicate that .post-user is the class also in css.
Andrew Corcoran
@corca
Mar 12 2015 20:20
So .post-user has a margin: 5px
Which won’t center it
On top of that, placing an img with that class inside of a div with that class will push the image another 5px
Jimmy Bryant II
@JimBry
Mar 12 2015 20:21
Oh so the margin is the problem if i remove it it will center?
Andrew Corcoran
@corca
Mar 12 2015 20:23
The class is the problem.
Jimmy Bryant II
@JimBry
Mar 12 2015 20:24
Okay, hmm should I just create a whole new class specifically for the image?
Andrew Corcoran
@corca
Mar 12 2015 20:24
I would give the image its own class and play with that to get the result you want
Jimmy Bryant II
@JimBry
Mar 12 2015 20:25
Yep we're on the same page!
Andrew Corcoran
@corca
Mar 12 2015 20:25
Because width and height will also affect the image
Jimmy Bryant II
@JimBry
Mar 12 2015 20:25
Thanks!
Andrew Corcoran
@corca
Mar 12 2015 20:25
You could also do something like
Jimmy Bryant II
@JimBry
Mar 12 2015 20:25
Oh really?
Andrew Corcoran
@corca
Mar 12 2015 20:26
.post-user > img to only select imgs where an element with a class of .post-user is the parent
Jimmy Bryant II
@JimBry
Mar 12 2015 20:31
I'm not really understanding haha so the image class: '.post-user img' should be the child class name to the parent class: '.post-user'?
Andrew Corcoran
@corca
Mar 12 2015 20:32
No, in your css, you can use the selector .post-user > img to select only img elements who are children of elements with the class of post-user
Julie Myers
@BlueOceanView
Mar 12 2015 20:34
/* >  Child Combinator/Child Selector */
/*
The greater than sign is referred to as a "Child Combinator", and selectors that use child combinators 
are called "Child Selectors."  They target elements that are direct children of other elements.  
For example:
    <div class=”main”>
       <a href=”todo.html”>Todo Page</a>
        <p>I be the leader.  
               Go here <a href=”gohere.html”>Go Here</a>
          </p>
    </div>
    .main > a{color: red;}
In the example above only the Todo Page link will be turned red, because only that <a> element is a 
direct descendant of the .main class.  The Go Here link is not so direct.  However, if I were to take 
the child selector out (greater than sign) and just leave a space so that it is a descendant selector, 
both links would be turned red. 
*/
Andrew Corcoran
@corca
Mar 12 2015 20:34
:+1:
Julie Myers
@BlueOceanView
Mar 12 2015 20:37
The > selector has good cross browser compatibility too:
http://www.quirksmode.org/css/selectors/
Jimmy Bryant II
@JimBry
Mar 12 2015 20:39
I tried this and it still didn't make the visible change. Should I just make the img class name different?
.post-user {
  margin: 5px;
  background: #eee;
  color: #ccc;
  text-align: center;
  line-height: 50px;
  font-weight: 600;
  border-radius: 50px;
  width: 60px;
  height: 60px;
}
.post-user > img {
  border-radius: 50px;
  width: 60px;
  height: 60px;
}
Andrew Corcoran
@corca
Mar 12 2015 20:39
Did you remove the post-user class from the img element?
Jimmy Bryant II
@JimBry
Mar 12 2015 20:40
face palm thanks! aha
@BlueOceanView Thanks for the link also!
Paul C
@realPaulC
Mar 12 2015 20:55
function end(str, target) {
  var strArray = str.split(" ");
  var targetArray = target.split("");
  var targetLength = target.length;
  var lastArray = strArray[strArray.length-1].split("");
  var lastLength = lastArray.length;
  for (var i = (lastLength-1); i>=lastLength-targetLength; i--) {

   if (lastArray[i] === targetArray[targetLength-1]) {
      return true;
    }
    else { 
    return false;
    }
  }


}

end('He has to give me a new name', 'name');
does this look messy ?
its a bonfire i just finished. it took me a while and i wonder if i missed a much easier way to do it
Cristián Berríos
@crisberrios
Mar 12 2015 20:56
I'll pm you a shorter answer
Suzanne Atkinson
@AdventureBear
Mar 12 2015 20:56
which bonfire?
Paul C
@realPaulC
Mar 12 2015 20:56
"Confirm the Ending"
you need to return true when the end of the first argument matches with the second argument
Paul C
@realPaulC
Mar 12 2015 21:01
thank you @crisberrios for introducing me to .indexOf()
Paul C
@realPaulC
Mar 12 2015 21:10
wait, though, that works no matter what the characters are
because its based on matching numeric values... no?
Paul C
@realPaulC
Mar 12 2015 21:15
i get it now. @crisberrios is a legend
Suzanne Atkinson
@AdventureBear
Mar 12 2015 21:15
yes he is.
Hey folks, i am doing some scotch.io tutorials, and I am seeing 2 different ways to create routes.
in ome the routs are created with this type of syntax:
Cristián Berríos
@crisberrios
Mar 12 2015 21:16
If I can get a good job anywhere during the next 6 months then call me a legend :P
Suzanne Atkinson
@AdventureBear
Mar 12 2015 21:17
app.get('/api/todos', function(req, res) { stuff here });
and in the other like this:
var router = express.Router(); 

// middleware to use for all requests
router.use(function(req, res, next) {
    // do logging
    console.log('Something is happening.');
    next(); // make sure we go to the next routes and don't stop here
});

// test route to make sure everything is working (accessed at GET http://localhost:8080/api)
router.get('/', function(req, res) {
    res.json({ message: 'hooray! welcome to our api!' });
});
Cristián Berríos
@crisberrios
Mar 12 2015 21:19
both are valid
Suzanne Atkinson
@AdventureBear
Mar 12 2015 21:19
in which the router is used. I'm trying to combine ideas and understand if this is an either /or option between two differetn applications?
if I already have the router established
can I just copy the similar syntax for further routes?
Cristián Berríos
@crisberrios
Mar 12 2015 21:19
for a simple api, you only define .get .post etc
but for a bigger app
you might want to attach your routes to different parts of the application
like you don't know if your app will end on /AdventureBear or /Suzanne
so you create a router
and then attach the router to your desired endpoint
Suzanne Atkinson
@AdventureBear
Mar 12 2015 21:20
I think I like the router
Cristián Berríos
@crisberrios
Mar 12 2015 21:20
router makes it more modular
Suzanne Atkinson
@AdventureBear
Mar 12 2015 21:21
how would you define "big"? having more than one 'node' like you gave an example of? (/AB vs /Suzanne
)
Cristián Berríos
@crisberrios
Mar 12 2015 21:22
matter of taste, not really a hard definition for small or big
we are only dealing with 1 node in Kopernik and still using route
Suzanne Atkinson
@AdventureBear
Mar 12 2015 21:31
thanks @crisberrios
Priscilla P. Wood
@RailsGirl
Mar 12 2015 21:36
Hi coders, I need help with github
:(
Suzanne Atkinson
@AdventureBear
Mar 12 2015 21:37
whatcha need?
Priscilla P. Wood
@RailsGirl
Mar 12 2015 21:39
it says
let me do a screenshot
Screen Shot 2015-03-12 at 2.40.51 PM.png
I’m trying to push code into my repo but it’s being rejected.
It says I need to pull the repo?!
Suzanne Atkinson
@AdventureBear
Mar 12 2015 21:43
hmm. i don't know
Priscilla P. Wood
@RailsGirl
Mar 12 2015 21:43
ok I’ll ask later thank you thou
Suzanne Atkinson
@AdventureBear
Mar 12 2015 21:44
did you create your remote repository already?
Cristián Berríos
@crisberrios
Mar 12 2015 21:45
@RailsGirl you have to do git fetch 1st
then merge/pull the changes
Priscilla P. Wood
@RailsGirl
Mar 12 2015 21:45
fetch it? I did the same as with my other repos
Cristián Berríos
@crisberrios
Mar 12 2015 21:45
and then push again
Danny Fritz
@dannyfritz
Mar 12 2015 21:45
yeah, looks like your repo is out of sync
Priscilla P. Wood
@RailsGirl
Mar 12 2015 21:45
ok, please fetch it, what is that?
so it’ll look like git fetch —all?
Danny Fritz
@dannyfritz
Mar 12 2015 21:46
yeah, git fetch --all should work
Priscilla P. Wood
@RailsGirl
Mar 12 2015 21:46
oh, how did you do those fonts? @dannyfritz
Danny Fritz
@dannyfritz
Mar 12 2015 21:47
if you surround text in a backtick (`) it will do that
Cristián Berríos
@crisberrios
Mar 12 2015 21:47
This message was deleted
async editing :P
Priscilla P. Wood
@RailsGirl
Mar 12 2015 21:47
‘cool'
‘cool'
(‘cool')
Cristián Berríos
@crisberrios
Mar 12 2015 21:48
they have to be backticks
`

Rails

Girl

Priscilla P. Wood
@RailsGirl
Mar 12 2015 21:48
shoot, ok don’t panic!!! hahahaha I totally have this :)
totally got it
cool guys, now back to gh!! I’m gonna try
Cristián Berríos
@crisberrios
Mar 12 2015 21:49
:thumbsup:
Priscilla P. Wood
@RailsGirl
Mar 12 2015 21:58
grrr
Screen Shot 2015-03-12 at 2.58.48 PM.png
ok so I fetched it already now I get this message and it’s not going anywhere
Cristián Berríos
@crisberrios
Mar 12 2015 22:07
do a git pull or merge
Danny Fritz
@dannyfritz
Mar 12 2015 22:07
it is having you do a commit for the merge
Suzanne Atkinson
@AdventureBear
Mar 12 2015 22:08
do you guys think I should persist with Angular tutorials since FCC is moving away from them?
it
i've built a back end node.js http server & some models and am ready to give the tfront end a try from scratch. The tutorials are using angular. (scotch.io).
or is there another that I should invest my time in learning?
Cristián Berríos
@crisberrios
Mar 12 2015 22:10
It's a personal matter of preference
Angular is very popular
and if you are looking after a job is a good thing to know
I have to learn it, I know, but I don't like it, so I'm postponing it
Suzanne Atkinson
@AdventureBear
Mar 12 2015 22:11
i'm more concerned with function and efficient time spent learning. I don't plan to get a full time dev job
I want to write apps that work.
everyone says that the 2.0 will be totally different so don't spend time on learning 1.0
Cristián Berríos
@crisberrios
Mar 12 2015 22:12
then it's just a matter of personal taste
Suzanne Atkinson
@AdventureBear
Mar 12 2015 22:12
what are other options then?
Cristián Berríos
@crisberrios
Mar 12 2015 22:12
1.x will stick around for a while
Suzanne Atkinson
@AdventureBear
Mar 12 2015 22:12
I am still navigating all this stuff...the connection to the API I guess?
Cristián Berríos
@crisberrios
Mar 12 2015 22:12
there are still Visual Basic 6.0 apps floating around, for comparison :P
Suzanne Atkinson
@AdventureBear
Mar 12 2015 22:12
lol...well I'm not writing in VB anymore either. :)
Cristián Berríos
@crisberrios
Mar 12 2015 22:13
I think quincy posted a comparison of current popular frameworks
Avremel Kaminetzky
@avremel
Mar 12 2015 22:13
I have come accross code where element of array is being accessed as array[—i] in a for loop. Can someone please explain what that would mean?
Cristián Berríos
@crisberrios
Mar 12 2015 22:15
arr[--i] that way?
Avremel Kaminetzky
@avremel
Mar 12 2015 22:17
@crisberrios yes code is here: http://jsfromhell.com/math/mmc
Suzanne Atkinson
@AdventureBear
Mar 12 2015 22:18
thanks @crisberrios . I could also just learn it, and probabaly will focus on it as a secondary thing after I get some stuff going and off my mini project list.
Cristián Berríos
@crisberrios
Mar 12 2015 22:18
that means you first decrease i value by one, then get it's value
Avremel Kaminetzky
@avremel
Mar 12 2015 22:18
The LCM bonfire that has been robbing me of my sleep
Cristián Berríos
@crisberrios
Mar 12 2015 22:18
don't focus on LCM code, focus on LCM algebra
then implement the algorithm
@AdventureBear I already have an idea for a project, I think it's simple yet complex enough to be portfolio-worthy
Suzanne Atkinson
@AdventureBear
Mar 12 2015 22:20
nice!
I think I'll just do the angular tutorials that are right in front of me
Avremel Kaminetzky
@avremel
Mar 12 2015 22:21
@crisberrios I tried it that way, found algorithm of first determaning the prime factors and then using the prime factors of each number arrive at LCM. My problem was that I couldn’t figure out the last step (after getting prime factors) in javascript with the skills I have.
Suzanne Atkinson
@AdventureBear
Mar 12 2015 22:21
then I'll ahve somethign to compare to
Cristián Berríos
@crisberrios
Mar 12 2015 22:22
@avremel you can brute-force your way using modulo A%n === 0 && B%n === 0
Suzanne Atkinson
@AdventureBear
Mar 12 2015 22:30
uh oh...
where is my data going?
I have a mongdb server set up with a db name 'bikebuilder' and the server is running with that db in use
I am connecting to the db using mongoose.connect('mongodb://localhost');
and have added 2 models (bears & todos) each with a key//value pair
but in the mongo terminal, i can't find my bears or todos, only the dummy data I started with in bikebuilder.
when i do show dbs
Oh wait..
I get this:
admin          (empty)
bikebuilder    0.078GB
freecodecamp   0.078GB
local          0.078GB
pacemaker-dev  0.078GB
test           0.078GB
oh wait
its in 'test'
with other stuff
Priscilla P. Wood
@RailsGirl
Mar 12 2015 22:35
Thank you guys, I kinda of fixed it, kinda.
Suzanne Atkinson
@AdventureBear
Mar 12 2015 22:35
i thought it'd be in the db that was in use in my mongo server
PHew, OK, I found my bears.
:)
Suzanne Atkinson
@AdventureBear
Mar 12 2015 23:46
OK, cool stuff... i just downloaded a txt file from a supplier site, manipulated by removing a comment file in the first row, removed non UTF8 characters and imported it into a mongo collection!
Danny Fritz
@dannyfritz
Mar 12 2015 23:48
woot, data munging
Suzanne Atkinson
@AdventureBear
Mar 12 2015 23:48
took a bunch of googling, and a hint of knowing where to look like using the bash terminal for file manipulation
@dannyfritz do you know if there's an easy way to create a mongoose model for this database without manually typing through each of the properties? I already hvae the database collection in mongo..c.an I get it to create it's own schema?
Danny Fritz
@dannyfritz
Mar 12 2015 23:51
not sure
Suzanne Atkinson
@AdventureBear
Mar 12 2015 23:53
I think this might be asking the same question
but not sure what to do with the info
except try it, lol.
in particular this bit of code
function find (collec, query, callback) {
    mongoose.connection.db.collection(collec, function (err, collection) {
    collection.find(query).toArray(callback);
    });
}
is there a mongoose command line I can test these things on?