- MongoDB là một hệ quản trị cơ sở dữ liệu mã nguồn mở, là CSDL thuộc NoSql và được hàng triệu người sử dụng.
- MongoDB là một database hướng tài liệu (document), các dữ liệu được lưu trữ trong document kiểu JSON thay vì dạng bảng như CSDL quan hệ nên truy vấn sẽ rất nhanh.
- Với CSDL quan hệ chúng ta có khái niệm bảng, các cơ sở dữ liệu quan hệ (như MySQL hay SQL Server...) sử dụng các bảng để lưu dữ liệu thì với MongoDB chúng ta sẽ dùng khái niệm là collection thay vì bảng.
- So với RDBMS thì trong MongoDB collection ứng với table, còn document sẽ ứng với row , MongoDB sẽ dùng các document thay cho row trong RDBMS.
- Các collection trong MongoDB được cấu trúc rất linh hoạt, cho phép các dữ liệu lưu trữ không cần tuân theo một cấu trúc nhất định.
- Thông tin liên quan được lưu trữ cùng nhau để truy cập truy vấn nhanh thông qua ngôn ngữ truy vấn MongoDB
Tạo một cluster MongoDB: link
- Chỉ có thể kết nối đến một cluster từ một địa chỉ IP đáng tin cậy.
- Whitelist là một list các địa chỉ IP đó
- Bạn phải thêm địa chỉ IP của mình vào trước khi muốn truy cập đến cluster.
- Bạn phải tạo db user để truy cập vào cluster
- Atlas yêu cầu người dùng phải xác thực là một MongoDB db user để truy cập cluster
- Database user và Atlas user là 2 khái niệm khác nhau:
Translated from https://blog.isquaredsoftware.com/2020/05/blogged-answers-a-mostly-complete-guide-to-react-rendering-behavior/, author: Mark Erikson (from Redux team)
Bài viết cung cấp chi tiết về cách mà React render hoạt động, và việc sử dụng Context và Redux ảnh hưởng thế nào tới quá trình render của React.
Rendering is the process of React asking your components to describe what they want their section of the UI to look like, now, based on the current combination of props and state.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 1. Parity of Number | |
| let n = 2; | |
| const result1 = n % 2 === 0 ? 'even' : 'odd'; | |
| console.log('result1', result1); | |
| // 2. Allow to Contest | |
| const minAge = 7; | |
| const maxAge = 12; | |
| const age = 7; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 412. Fizz Buzz | |
| /** | |
| * @param {number} n | |
| * @return {string[]} | |
| */ | |
| var fizzBuzz = function(n) { | |
| let arr = []; | |
| for (let i = 1; i <= n; i++) { | |
| if (i % 3 === 0 && i % 5 === 0) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const peopleNameArray = ['William', 'Collin', 'Stephen']; | |
| const showPeopleName = function (name) { | |
| console.log(`Hello ${name}`); | |
| }; | |
| peopleNameArray.forEach(showPeopleName); | |
| peopleNameArray.map(showPeopleName); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const showProfile = (name, lastname, age, profession, salary) => { | |
| console.log( | |
| `My name is ${name} ${lastname}, i'm ${age} years old. I work as ${profession} and make $${salary}.` | |
| ); | |
| }; | |
| showProfile('Hoang', 'Pham Minh', '18', 'Front-end Developer', '10'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const players = [ | |
| { jersey: 56, name: 'Djounte Murray', position: 'Point guard', PPG: 2.6 }, | |
| { jersey: 98, name: 'Dennis Rodman', position: 'Small Forward', PPG: 10.8 }, | |
| { | |
| jersey: 1, | |
| name: 'Michael Jordan', | |
| position: 'Small Forward', | |
| PPG: 345.6, | |
| }, | |
| { jersey: 2, name: 'Lebron James', position: 'Shooting Guard', PPG: 26.7 }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const products = [ | |
| { name: 'Iphone', price: 200 }, | |
| { name: 'Motorola', price: 70 }, | |
| { name: 'Samsung', price: 150 }, | |
| { name: 'Sony', price: 98 }, | |
| { name: 'Windows pone', price: 10 }, | |
| ]; | |
| const result = products.map( | |
| (product) => `Name: ${product.name} Price. - Price: ${product.price}$` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const paintings = [ | |
| { name: 'Mona lisa', width: 200, height: 200 }, | |
| { name: 'The scream', width: 400, height: 600 }, | |
| { name: 'The last supper', width: 600, height: 700 }, | |
| ]; | |
| const messages = paintings.reduce((acc, cur) => { | |
| acc.push(`The ${cur.name} is ${cur.width} x ${cur.height}`); | |
| return acc; | |
| }, []); |
OlderNewer
