Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a sample MongoDB Database along the lines of world for MySql? [closed]

Tags:

mongodb

As someone new to Mongo, I am looking for a sample MongoDB database that I can import and play with. Something along the lines of world for mysql or Northwind for MSSQL.

Is there one? (I couldn't find any reference to one at http://www.mongodb.org nor did my googling help)

like image 850
Amol Katdare Avatar asked Apr 19 '11 23:04

Amol Katdare


People also ask

Can I use MongoDB instead of MySQL?

MongoDB is an ideal choice if you have unstructured and/or structured data with the potential for rapid growth while MYSQL is a great choice if you have structured data and need a traditional relational database.

What are the disadvantages of MongoDB over MySQL databases?

Disadvantages of MongoDBMongoDB uses high memory for data storage. There is a limit for document size, i.e. 16mb. There is no transaction support in MongoDB.

Which database is better MongoDB or MySQL?

MySQL is an excellent choice if you have structured data and need a traditional relational database. MongoDB is well-suited for real-time analytics, content management, the Internet of Things, mobile, and other types of applications.

What is the MongoDB equivalent for a MySQL table?

MongoDB is a document-based non-relational database management system. It's also called an object-based system. It was designed to supplant the MySQL structure as an easier way to work with data. On the other hand, MySQL is a table-based system (or open-source relational database).


2 Answers

I found this you can import the json data with:

mongoimport --db scratch --collection zips --file zips.json 

I guess that you can import any json data that you find, it also supports csv and tsv. Hope this helps.

like image 68
sirfilip Avatar answered Nov 09 '22 01:11

sirfilip


For *NIX/Mac OS this can be done in two simple steps

wget http://media.mongodb.org/zips.json mongoimport -v --file=zips.json 

For Windows users: Please follow the following steps to import from the json file if you are using windows 7:

  • Download the above mentioned JSON file and place it inside a folder (say d:\sample)
  • Open a command prompt, start the mongo server by going in to the bin directory and typing in mongoD
  • Now take another command prompt and go to the bin directory again and write the following command

    C:\mongodb\bin>mongoimport --db test --collection zips --file d:\sample\zips.json

  • The import should start working immediately and at the end it should show something like this : Thu Dec 19 17:11:22 imported 29470 objects

That's it!

like image 26
Muzzamil Hussain Avatar answered Nov 08 '22 23:11

Muzzamil Hussain