stack" trace of the root cause is available in the Apache tomcat/6.0.41 logs.
In the view of exceptions, this is due to a MongoDB connection timeout. So, to MongoDB to find the reason. First on the MongoDB configuration file:
Copy Code code as follows:
mongodb.replica-set=192.98.12.242:30007,192.98.12.245:30007
mongodb.hostname=192.98.12
On an article we said MongoDB remote connection configuration, today to you how to create a database MongoDB and configure users, after all, the light has remote connection is not enough, we have to go up and operate and put data.System: CentOS 5.xEnvironment: MongoDB1. Installing MongoDBThis step will not say, everyone to see the CentOS installation
exceeds the original space, it is still necessary to allocate a new space. In addition to slowing down the space allocation,
At the same time, as the array grows, MongoDB takes a longer time to traverse the entire array, and the modification to each array slows down.
"$ Push" or other array modifiers are recommended. However, if "$ push" becomes the efficiency bottleneck, you need to separate the embedded array and put it
In a separate set.
3. upse
MongoDB didn ' t provides any command to create "database". Actually, you don ' t need to create it manually, because, Mangodb'll create it on the fly, during the first time you save The value into the defined collection (or table in SQL), and database.For developer from SQL background, we need to
MongoDB's binary installation is extremely simple. By default, it is not authenticated by users according to the official documentation... Despite its high efficiencyNot safe.The following describes how to use auth for user authentication (I haven't seen the keyFile method yet ..)1) start mongodb without the-auth parameter2) create a User Administrator.Mo
Label:Basic syntaxThe syntax format for MongoDB database creation is as follows:Use database_name
If the database does not exist, create the database, or switch to the specified database.InstanceThe following example we created the database Coderschool:> Use Coderschool
switched to DB Coderschool
> DB
coderschool
>
If you want to see all the databases, you can use the show DBS command:> Show dbs
local 0.078
Create a Mongodb Database
Because Mongodb is not a relational database file, it does not actually have the so-called "Database" concept in traditional relational databases, but don't worry. When you add data for the first time, mongodb will be saved and created in the form of collection sets without manual creation. Th
ASP. NET MVC4 uses MongoDB to create album management, mvc4mongodb
ASP. NET MVC4 use MongoDB to create an album to manage instance sharing
TIPS:1. Convert the Image to Base64 and save it to the mongodb field.2. Data Models are nested associations
First defineModel layer:
p
prompts and other functions, just need to create, start can be quickly developed.Before use we need to install in the global:NPM Install Creat-react-app-gMongodbMongoDB and node. JS are particularly well-matched because MongoDB is a document-based, non-relational database that is stored in Bson (the lightweight binary format of JSON), the commands for managing databases such as additions and deletions, and
removed all of the users ' indexes, now establish a positive index on the name field, and then rebuild the reverse index on the name field, and you can see that the Rebuild index deletes the index of the previous name field and creates a new index, and the name field or only one index before rebuilding.> Db.users.createIndex ({name:1}) {"createdcollectionautomatically": false, "Numindexesbefore": 1, "Numindexe Safter ": 2," OK ": 1}> db.users.getIndexSpecs () [{" V ": 1," key ": {" _id "
Tags: use body show Sch database otherwise name OCA defaultGrammarThe syntax format for MongoDB database creation is as follows:Use database_nameIf the database does not exist, create the database, or switch to the specified database.InstanceThe following example we created the database Youj:> Use Youj
switched to DB Youj
> DB
youj
>
If you want to see all the databases, you can use the show dbs command:>
Label:MongoDB CREATE DATABASE syntaxThe syntax format for MongoDB database creation is as follows: Use database_name If the database does not exist, create the database, or switch to the specified database.InstanceThe following example we created the database Runoob: > Use runoob
switched to DB Runoob
>> If you want to see all the databases, you can use the sh
Create a documentInserting data into MongoDB, using INSERT,such as: Db.refactor.insert ({"Refactor ' s Blog": "Http://www.cnblogs.com/refactor"})This action adds a "_id" to the document, and the key is saved in the database.BULK INSERTIf you want to insert multiple documents, using BULK Insert will be faster, BULK insert can pass in a document composed of data to the databaseA BULK insert is just a single T
When creating a new connection, php always takes one second to refresh, and the successive time is almost 0. After a few minutes, it will take another second to connect.
Php always takes 1 second to create a new connection.
After a short refresh, the connection time is almost 0, and it will take another 1 s to connect in a few minutes.
Reply content:
Php always takes 1 second to create a new connection.
Tags: style blog http color io os ar using StrongInsert and save document actionsInserts a document into the target collection with insert, which is added automatically if there is no _id key. finally automatically saved.>db.foo.insert ({"Bar": "Baz"})If you want to BULK insert What to do, look at the following code:>db.foo.insert ([{"_id": 0},{"_id": 1}, "{" _id ": 2}])There used to be a batchinsert function, and now it's gone. Note that if one of the document inserts fails during bulk INSERT,
1, add a useradminanydatabase user, this is a user can manage all users, similar to the Super Admin bar
#打开mongo Shell
[root@localhost]# MONGO
#添加超级管理账号
> Use admin #进入admin表
> Db.createuser (
{ User
: "myadmin",
pwd: "Secret",
roles:[{role: "Root", DB: "Admin"}]
}
)
# to see if users have successfully created
>show Users
# Output indicates that the add succeeded
{
"_id": "Admin.myadmin",
"user": "MyAdmin",
"db": " Admin ",
" roles ": [
{
" ro
(1) CREATE DATABASE syntax: Use database_nameFor example:> Use RunoobSwitched to DB runoob> dbRunoob>(2) Delete database syntax: Db.dropdatabase ()For example:Db.dropdatabase () {"Dropped": "Runoob", "OK": 1}(3) Delete collection: Db.collection.drop ()(4) Display of all databases> Show Dbslocal 0.078GBRunoob 0.078GBTest 0.078GBThe default database in MongoDB is test, and if you do not
the update fourth parameter to TRUE.Findandmodify: Returns the matching result in one artificial and updates it.Optional fields:Findandmodify: String, collection name.Query: Queries the document.Sort: The result condition of the sort.Update: the modifier document.Remove: A Boolean type that indicates whether the document is deleted.NEW: Boolean type that indicates whether to return the document before the update or the updated document. The default is the pre-update document.Fields: The field t
Tags: style io strong for AR problem new sizeCannot create abstract classWe all know that abstract classes cannot be instantiated, that is, they cannot be new.You experience this problem in the following situations:1. The base class is an abstract class:2. The base class is an interface:Because of the nature of MongoDB, when you save a subclass of an abstract class or interface, a field "_t" is automaticall
": "LCQ"}The array is positioned using the $ character to update the value at a specific position in the array.> LCQ = Db.user.findOne () { "_id": ObjectId ("55024de2849b70a4f670f413"), "address": { "province": " Shandong ", " location ":" Zoupin " }, " Count ": 3, " Friends ": [ " Zhangsan ", " join ", " Xiaoming " ], " haha ":" AFDFDFD ", " sex ":" Man ", "
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.