Skip to content

Instantly share code, notes, and snippets.

@akshaymittal143
Created September 22, 2017 00:22
Show Gist options
  • Save akshaymittal143/f86b7a474a5ef5d530786b74b471791f to your computer and use it in GitHub Desktop.
Save akshaymittal143/f86b7a474a5ef5d530786b74b471791f to your computer and use it in GitHub Desktop.
To import Book data into your mongoDB database. Make sure MongoDB is running then run 'mongo bookAPI < booksJson.js' from the command line.
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
}
])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment