This week's study is mainly Nodejs database interaction, and using the Jade template to do a user-validated site. Mainly encountered a few problems.
1.mongodb version is too low
NPM err! Not compatible with your operating system or
Background
Recently I was writing a test kit with a bug-recording system, because I was using Django and MongoDB in the background, and I ran into a problem with how to implement a self added field.
The traditional relational database is very easy
MongoDB is a document-based database system, DOC is the data unit of MongoDB, each doc corresponds to a relational database row (row), the difference between Doc and row is the atomicity of field: column in row is not and split atomic object, The
This section describes the master-slave architectureMaster-Slave architecture--deprecated, recommended for use with replica setsThe master-slave configuration can be configured in the configuration fileFrom node can use command to append master node
1. How to read data from a backup nodeDefault is not allowed, the following error will be reported:Testreplset:secondary> Show dbs- -19t10:03.196+0800 E QUERY "OK"0"errmsg" " Not master and Slaveok=false""code"13435If you want to allow the backup
I. GENERAL Enquiry1.1. View all the documents in the collectionCommand: DB. Collection name. Find ();650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M01/96/C3/wKioL1klMluQ-3MuAAAXdHmOllE584.jpg "title=" 1495609994 (1). jpg "alt="
MongoDB DatabaseView database: Show DBS;Create/Switch database: Use F28 (F28 for database name)To view a running database: DB;Crud Additions and deletions (create retrive update delate)Add:
Problem Description:When analyzing performance problems in a production environment, it is often impossible to do so without a real-time basis. Then the author captures Db.currentop () to the file, and as a timed task, is available for subsequent
Among them,nodejs remote connection MySQL databaseFirst, the opening analysisThis is an extended knowledge article because database operations are used in the following article, so today it is (MongoDB module).(1), introductionMongoDB is a database
MongoDB Delete Database syntaxThe syntax format for MongoDB database deletion is as follows:Db.dropdatabase ()Delete the current database, which is test by default, and you can use the DB command to view the current database name.InstanceThe
# mongodb3.2.1 The main configuration file, put this file in Mongodb3.2.1/bin directory # hapday 2016-01-27-16:55 start# data file directory DBPath =/usr/local/mongodb/ mongodb3.2.1/data/db# log file storage directory LogPath
Found spring4-mongo3.2.1 plus user name password authentication can not be authenticated after the problem.1. The user must be built under the currently used database, and the permissions can be given to ReadWrite2. Because the MONGODB2 and MONGODB3
First, the index base:MongoDB's index is almost identical to the traditional relational database, which includes some basic optimization techniques. Here is the command to create the index:> Db.test.ensureIndex ({"username": 1})You can see whether
Query for MONGODB data:Find Method:function (Query, field, limit, skip, batchsize, options) {/*query : Query condition fields: Returns the column limit: Skip: batchsize: options: */}View CodeQuerying all data in a collectionDb.user.
1 var result = Db.users.findOne ({"Name": "Tom Wu"},{"address_ids": 1,_id:0})23 var address = Db.address.find ({"_id": {"$in": result["Address_ids"]}})The data structures in the user table are as follows{ "_id": ObjectId
Create a databaseUse database_name is used to create a database. This command will create a new database if the database does not exist, or it will return the existing database.Grammar:Use database_nameTo check the currently selected database using
http://www.ttlsa.com/mongodb/mongodb-sort-limit-skip-usage/1. Sort is used for sorting. Sort ({"Field": 1})2. Skip skips how many results3, limit each query returns the maximum number of results;The use of the project is relatively good;Record again;
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service