Skip to content

Instantly share code, notes, and snippets.

@jonathanfmills
Created April 14, 2015 18:49
Show Gist options
  • Select an option

  • Save jonathanfmills/d337dae91d75ab71ec0f to your computer and use it in GitHub Desktop.

Select an option

Save jonathanfmills/d337dae91d75ab71ec0f to your computer and use it in GitHub Desktop.
MongoDB Import for REST APIs course
db.books.insert([
{
title: 'War and Peace',
genre: 'Historical Fiction',
author: 'Lev Nikolayevich Tolstoy',
read: false
},
{
title: 'Les Misérables',
genre: 'Historical Fiction',
author: 'Victor Hugo',
read: false
},
{
title: 'The Time Machine',
genre: 'Science Fiction',
author: 'H. G. Wells',
read: false
},
{
title: 'A Journey into the Center of the Earth',
genre: 'Science Fiction',
author: 'Jules Verne',
read: false
},
{
title: 'The Dark World',
genre: 'Fantasy',
author: 'Henry Kuttner',
read: false
},
{
title: 'The Wind in the Willows',
genre: 'Fantasy',
author: 'Kenneth Grahame',
read: false
},
{
title: 'Life On The Mississippi',
genre: 'History',
author: 'Mark Twain',
read: false
},
{
title: 'Childhood',
genre: 'Biography',
author: 'Lev Nikolayevich Tolstoy',
read: false
}
])
To import Book data into your mongoDB database. Make sure MongoDB is running then run 'mongo bookAPI < booksJson.js' from the command line.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment