Why is MongoDB being created
MongoDB tutorial: installation and getting started
Usually the different database models - SQL or NoSQL - differ significantly in terms of configuration and operation. The open source software MongoDB proves that when using a NoSQL solution you do not always have to throw away all the know-how about relational database systems that has been accumulated over the years flexible data storage clearly differs from classics such as MySQL, but the models have certain similarities, which you can read in our introductory guide on the subject. Even if the query language and command syntax of MongoDB require getting used to, the entry or switchover usually does not present any great difficulties for tried and tested SQL experts.
In the following MongoDB tutorial, we will take a closer look at the installation, configuration and administration of the modern database system using the example of Ubuntu apart.
Step 1: installation
You can find the freely available open source edition “Community Server” as well as the commercial enterprise solutions in the download center on the official MongoDB website. So in the first step you should use the Installation or binary files for your systemFind and download it. Since MongoDB is cross-platform, there is a selection from various Windows and Linux systems as well as OS X and Solaris.
On a Windows operating system, the database is simply installed in the desired directory using the downloaded installation file. Windows 10 users can use the version for Windows Server 2008 (64-bit). For Linux and Co., download an archive file as usual, which you first unzip and then install using the package manager. Depending on the distribution, you may have to use the Import MongoDB Public GPG Key. This authentication key is required for Ubuntu, which is why you have to implement it with the following command:
Then update the list of the package manager:
... and install MongoDB including useful management tools:
Step 2: Start the MongoDB server
The default installation directory / var / lib / mongodb and the log directory / var / log / mongodb you can optionally use the Configuration file/etc/mongod.conf to change. Use the following command to start the database:
Use instead of the parameter begin the parameter stop, finish the Execution of the database, restart ensures a restart. To check whether MongoDB was started successfully, all you need to do is look at the log file /log/mongodb/mongod.log:
The line tells you that the database server is up and running and for incoming connections on the one defined in the configuration file port (
Step 3: Start the client
The Mongo Shell will now automatically connect to the running MongoDB instance on the local host and port 27017. Of course, you can also adjust these standard connection settings with the appropriate parameters. These and a few other important options are summarized in the following table:
|--shell||Activates the shell interface, which shows you the relevant display after executing a command.|
|--nodb||Prevents the Mongo Shell from connecting to a database.|
| --port ||Defines the port for the connection.|
| --host ||Defines the host for the connection.|
|--help or -h||Shows you the options.|
| --username || If access authorizations have been defined, log in with the respective user name (|
| --password || If access authorizations have been defined, log in with the respective password (|
The angle brackets used here are not part of the respective parameter and therefore do not appear in the final command. For the definition of the port this means, for example, that your entry looks like this if you prefer to select port 40000 instead of the standard port 27017:
Step 4: create a database
Once MongoDB and the client are up and running, you can focus on data management and manipulation. But first you should create a database - otherwise the collections and documents will be automatically generated in the test- Database saved. You create a database with the use-Command. Do you want to B. a database with the name mydatabase the corresponding command looks like this:
With the command use also select an existing MongoDB database that you will use for the Data processing want to use; using the short command db check which database is currently selected.
Step 5: create a collection
In the next step you create your first collection, i.e. one Folder for the various BSON documentsin which the data is to be saved later. The basic syntax has this pattern:
The createCommand has two parameters Surname (Name of the collection) and options (optional options for configuring the collection). In the options you determine e.g. B. Whether the documents contained in the collection should be limited in size (capped: true) or whether the collection has a limit in bytes (size:
Step 6: Insert documents into a collection
After the binder has been created, you can fill it with documents, three different methods are basically available:
So you either add only one document (.insertOne), various documents (.insertMany) or one or more documents (.insert). In the following example we will show you a simple one Database entry, which consists of the three pieces of information name, age and gender and as a document in the folder created in step 5 mycollection is inserted:
MongoDB automatically creates one for the respective collection for this and each subsequent entry unique ID.
Step 7: manage documents
The last step of our MongoDB tutorial is about the basic management of the created documents. Before you can make changes to the documents, you must first make them call. This query succeeds with the find-Command and can with the optional parameters query filter (Query filter) and projection (Specification of the display result). For example, to call up the document created in the previous step, the following command is suitable:
If you want to update this document now, you need the update-Function. Here you define the value to be changed, select one Update operator and indicate the changed value. Do you want to B. the field Age in the example mentioned, you need the operator $ set:
The others update-Operators can be found here.
Use this to delete the documents in a collection remove-Command:
You can just as easily remove individual documents from the collection by defining criteria such as the ID or exact values and thus signaling to MongoDB which Database entries it is about. The more specific you are, the more precisely the database system can act during the deletion process. The command
For example, deletes all entries that have the value 28 for the "Age" field. You can also specify that only the first entry to which this property applies should be removed by using the so-called justOne-Parameter (1) insert:
Further information such as about user administration, security settings, the creation of replicas or the distribution of data to multiple systems can be found in the official documentation on mongodb.com and in the MongoDB tutorial on tutorialspoint.com.
MySQLDumper: From installation to backup
In online business, data loss means a loss of capital, because “data is the new oil” - and thus cash. You should make backup copies at regular intervals, especially for important and sensitive data. With the help of the free program mySQLDumper, backups of mySQL databases can be created within a few minutes. Once installed, the software can also be used for backups ...
How to tag your website with RDFa according to schema.org
RDFa is a standard recommended by the W3C for embedding metadata in HTML, HTML5, XHTML and other XML dialects. The data format is considered to be the cornerstone of the Semantic Web. A standardized vocabulary is made available by the Schema.org project. Get to know the application possibilities and limits of the data format and gain an insight into the award of ...
MongoDB - the flexible and scalable NoSQL database
NoSQL databases have long since become serious alternatives to classic relational database systems such as MySQL. They replace the firmly defined storage structure of traditional models with flexible backup procedures. In this way, for. For example, the database can be easily distributed over several servers in order to guarantee high availability of web applications. But...
InnoDB - The Best MySQL Storage Engine?
InnoDB is currently the standard recommended storage engine for MySQL databases. In the meantime taken over by Oracle, the software is particularly convincing due to its transaction security. This article reveals which other properties make up InnoDB and where the differences to the predecessor MyISAM actually lie.
- Yelp is disproportionately popular with Asian Americans
- Really stops bars leak from cooler leaks
- Can I get two Bachelor degrees at the same time?
- What is the best online budgeting tool
- Is it illegal to bully your child?
- Am I religious
- In which countries is the QWERTY keyboard used?
- What is the galactic center
- Which is the easiest career option
- What if your first ex texts you
- Quora is a socialist-liberal website
- Is King of Prussia PA safe
- How we can make shareholders
- Are the Kurds Sunnis or Shiites
- Could gravitational waves fuse atoms
- Coldplay is a chick band
- What can i do with arduino
- What does 15 15 30x0 equal
- Has Intel really replaced Itanium with Xeon
- Can Canadians work at CERN?
- There were flightless pterosaurs
- What is autogenous shrinkage in concrete
- What happened before the story
- How is The Incredible Hulk changing the crowd
- How lived hunting and gathering
- Did anyone predict Trump would be charged?
- Why don't white women wear woven fabrics?
- What are characters on letters called ACae
- What are Zucca melons used for?
- Can India ever compete with China?
- Why does the pH of your pools keep increasing
- How soil compaction causes soil erosion
- What are your best photos in Lehengas
- What is new technology in mobile