Data persistence: Persistent Data persistence method: 1. File read/write 2.cookie, server stored in the client's data, the client will automatically send the cookie to the server (the cookie is stored in the HTTP header), Session + Cookie 3.
Localstorage, client local storage 4. Database Note: formatted string: json,xml mysql: relational database, tables and tables can be associated (primary key, foreign key, index); operation on relational database, general use of SQL (Structured query statement) MongoDB: Non-relational database, supporting the processing of big data, clustering (multiple servers connected together), distributed (the location of the server is not the same) relational non-relational database Database table collection Field field installation command: Brew INS Tall MongoDB Test Installation Successful command: Mogon appears version number MongoDB uses 1. Enter MONGODB Environment command: MONGO NOTE: The test database is connected by default, and you can create a database 2 yourself if you do not have a connection. New MONGONDB Database command: Mongod--dbpath folder path 3. In a MONGO environment (>), display all database commands: Show DBS 4. Switch database command: Use database name NOTE: When the database does not exist, and the database Operation to create a new database 5. New Collection Command: Dbcreatecollection (' collection name ') crud operation: Add (Create) Delete (delete) change (Update) (retrive) 6. Query command: DB. Collection name. Find () 7. Insert command: DB. collection name. Insert (data) Note: When the inserted collection does not exist, add one to the new collection for example: Db.student.insert ({name: ' Show ', Gender: ' Male ', age:18}) to add multiple lines for example:
Db.student.insert ([{name: ' Alice ', Gender: ' Female ', Age: '},{name ': ' Xiao Hong ', Gender: ' Female ', Age: ' 19 '}]) Note: The structure of an ID data is automatically added must be Bson Bson:binary JSON, a JSON-like binary data, like the JSON structure ({}: Document object, []: Array object), more than the data type supported by JSON (DATE,BINDATE) Note:The structure of the inserted data can be different 8. Displays the collection command in the database: Show Collections 9. Delete the collection db. Collection name in the database. Drop () 10. Modify Data command: DB. Set name. Update (query condition, modified content, optional parameters) Modify a data example: Db.student.update ({name: ' Alice '},{$set: {name: ' Xiao Yu '}}) modify multiple data db.student.update ({name: ' Xiaohong '},{$set: {name: ' Xiao Xiao ') }},{multi:true}) 11. Delete Data command: DB. Remove multiple data (query condition, optional parameter) For example: Db.student.remove ({name: ' Xiao Yu '}) delete a data such as:
Db.student.remove ({name: ' Xiao Xiao '},{justone:true}) visualization of the operating software: Robomongo