20191128 - Node.js

yjj·2019년 11월 28일
0

Node.js

  • Nodeschool / learnyoumongo

    • deprecated된 프로젝트인지? 최신 버전과 호환되지 않는 예제가 그대로 있다.

    • connect

      가이드에서는 db connect 예제를 아래처럼 알려준다. url에 database명을 붙여서 접속할 수 있었나보다.

      	```javascript
        var mongo = require('mongodb').MongoClient
        var url = 'mongodb://localhost:27017/learnyoumongo';
        
        mongo.connect(url, function(err, db) {
        		// db gives access to the database
        })
      	```

      현재 실습 환경 기준(≥ mongoDB 4.0) 아래처럼 바뀌어야 한다. url에서 database 이름이 분리된다

          var mongo = require('mongodb').MongoClient
          var url = 'mongodb://localhost:27017';
          
          mongo.connect(url, function(err, client) {
              var db = client.db('learnyoumongo');
          		// then db gives access to the database
          })
      		```
      
    • projection

      가이드에서 알려준 정답

      	```javascript
        mongo.connect(url, function(err, db) {
            if (err) throw err
        	  var parrots = db.collection('parrots')
            parrots.find({
              age: {
                $gt: +age
              }
            }, {
              name: 1
            , age: 1
            , _id: 0
            }).toArray(function(err, docs) {
        	    if (err) throw err
              console.log(docs)
              db.close()
            })
        })
      	```

      위의 코드는 동작이 안되고, 현재 버전에서 projection 테스트를 통과하기 위해선 아래처럼 코딩해야 한다. → 위의 connect와 비슷하다. 이전엔 projection object를 .find의 두번째 인자로 받아서 처리했으나, .project()라는 메소드로 분리된 듯.

      	```javascript
        parrots.find({age: {$gt: +age}}).project({name: 1, age: 1, _id: 0}).toArray(function(err, docs) {
            if (err) throw err
            console.log(docs)
            client.close()
        })
      	```

      자꾸 안되니까 그만하고 싶다. 내 인내심은 여기까지인가..

    • learnyoumongo 는 그만하기로 햇다!

    • mongoDB official course가 더 좋은 구성인 것 같다.

      Log In - MongoDB University

Bookmarks

  • 긴 긴 글..

[번역] 깊이 있는 리액트 개발 환경 구축하기

  • react-native-seoul meetup을 위해 숙지하자 (두근)

@testing-library/react-native 를 사용한 리액트네이티브 테스트 시작하기

  • React Native 꿀팁

[121]React Native: 웹 개발자가 한 달 만에 앱 출시하기

  • babel 설정. 제발 외우자

Babel | PoiemaWeb

Babel, Mocha, Karma and Webpack with coverage in order

  • 테스트 라이브러리 뭐 써야할 지 모르겠다!

https://medium.com/welldone-software/an-overview-of-javascript-testing-in-2019-264e19514d0a


오늘은 북마크만 가득이네..!

profile
개발 말고도 하고싶은게 너무너무 많은 개발자입니다

0개의 댓글