In MongoDB db.collection.find() method query documents from the collection. If there is no param in it or passing empty param like this db.collection.find({}) will get all documents in this collection. It is like using select * from table_name in structural database.
The default result of querying document in MongoDB is not formatted. But if you query one document by using db.collection.findOne() the result is formatted. Is there any way to format the result of db.collection.find()? Yes, use pretty() append db.collection.find(). Examples are here.
We need create table before inserting data into structure database(Mysql, PostgreSQL, Oracle etc.). It is no need to create collection for using MongoDB. The db.collection.insert() method adds new document into database. MongoDB will create collection when it not exist. You can also create collection manually then insert document.
Last week I found my site disappear from Google search result. I tried search "site:www.henryxi.com" but nothing there. A day later I received the message from Google Search Console. To my surprise, Google prevented my site because "Pure spam". The whole message is here
MongoDB is one kind of document-oriented NoSQL database. Open-source, cross-platform and free are the reasons large numbers of development team choose it. In this tutorial I will show you how to use it step by step.
Use db.dropDatabase() to delete the current selected database. If no database selected this command will delete the default database test. Before deleting you need show all database. Delete a database command like following.
In this tutorial I will show you how to display and download pdf file in Spring(Spring MVC). For quick beginning we use Spring Boot, and for displaying pdf we use jsp as view.(How to use jsp in Spring Boot, click Spring Boot JSP examples).
It is easy to use SimpleDateFormat format date in Java. There is no method in Javascript to format date directly. When we want format date in javascript we have to use Date method to get Day, Month, Year and combine them together manually.
We can not change class of element directly. But we can use two steps to change class. Remove old then add new one. Use addClass() function to add a class to each element. If you want add more than one class separating each one with a space. This function won't delete exist class it only append the specified class. Use removeClass() function to remove a class. Same as addClass() use space to separate multiple classes if you need remove more than one class.
Drop collection in MongoDB is easy. Use db.collection_name.drop() to drop the collection. All indexes in this collection will be also removed.
You can create collection explicitly or make MongoDB help you create collection automatically. When you create collection manually you can use specific options. You can create a capped collection or create a collection with document validation.
I don't like command prompt in windows. Linux command line is more power than windows. You can't even use tab to auto-complete the path accurately, especially you install the software in C:\Program Files. But, compare with opening a virtual machine installing software in windows is more convenient. Every time when I need use command prompt in windows I have to do following steps.
In MongoDB you do not need create database manually. MongoDB will create a new database if necessory. It is different from structure database. Open Mongo shell and type show dbs can show all database. Now there is only one database (local) in my computer.
In this page I will show you how to install MongoDB in windows as service. Download MongoDB .msi file here and install. I assume that you install it in C:\Program Files\MongoDB. MongoDB will connect C:/data/db as default dbpath, if this directory doesn't exist you have to tell MongoDB the right dbpath. I create two directories for log(D:\mongo_data\log) and database(D:\mongo_data\db).
When add multiple CSS to the same element which one will work? These CSS code may be in same CSS file, but for the most case they are not. The question is which one will work? I found the answer here When browser parse the CSS it calculates the selector's specificity. Browser will make high selector "override" the low selector.