Movie.insertMany([
    {title: 'Amelie', year: 2001, score: 8.3, rating: 'R'},
    {title: 'Alien', year: 1979, score: 8.1, rating: 'R'},
    {title: 'The Iron Giant', year: 1999, score: 7.5, rating: 'PG'},
    {title: 'Stand By Me', year: 1986, score: 8.6, rating: 'R'},
    {title: 'Moonrise Kingdom', year: 2012, score: 7.3, rating: 'PG-13'}
])
.then(data => {
    console.log("IT WORKED!")
    console.log(data);
})

위와 같은 코드를 입력하고 터미널 창에 가서 node index.js 명령어를 입력하여 index.js를 실행시키면 추가한 위의 코드로 인해 다량 데이터가 대량으로 Insert됨.

=> DB 조회 결과

 

+ Recent posts