mongo==> enter use xxx ==> select database db ==> View the currently connected database show dbs ==> view all databases db.dropDatabase() ==> destroy the database db.createCollection( "xxx")==> Create a collection show collections ==> view all collections db.xxx.deop() ==> delete collection db.xxx.insert([{name: "",},{name:""}])==> Insert data into the collection db.xxx.update([{}]) ==> update collection data db.xxx.remove([{}]) ==> delete collection data db.xxx.find() ==> query db.xxx.find().pretty ==> query results are more beautiful
db.post.find({
$or:[
{"by":"shiyanlou"},
{"title": "MongoDB Overview"}
]
}).pretty()
==>or usage
Conditional operator 1:
(>) greater than - $gt #greater than
(<) less than - $lt #less than
(>=) greater than or equal to - $gte #equal
(<= ) less than or equal to - $lte
Conditional operator 2:
type
example:
1. Look at the sql statement of the window and write down the returned sql parameters
2. Write down the method
3. Test sql in mongodb
4. There is a problem that the index cannot be empty in mongodb. Under the Maven command for multiple updates, the data corresponding to the local Maven cannot be deleted and then updated.
There is a problem that the index cannot be empty in mongodb. It cannot be deleted and updated under the Maven command for multiple updates.
Replenish:
In the mongoDB database, the time is saved in the ISODate type, and the orm relationship is mapped to the java.util.Date type. The time saved is 8 hours different from ours (the time saved is 8 hours earlier than us).