Tag : Database

Mongodb service crashed during scheduled task operation. When the query log found the crash, records in the following two formats were fixed: command admin.$cmd command: isMaster { ismaster: 1 } numYields:0 reslen:189 locks:{} protocol:op_query 1600ms serverStatus was very slow: { after basic: 600, after asserts: 1001, after backgroundFlushing: 1302, after connections: 1701, after dur: 2194, ..

Read more

Problem description The following data are available: { “_id” : 1, “name” : “dave123”, “favorites” : [ “chocolate”, “cake”, “butter”, “apples” ] } { “_id” : 2, “name” : “li”, “favorites” : [ “apples”, “pudding”, “pie”, “cake” ] } { “_id” : 3, “name” : “ahn”, “favorites” : [ “pears”, “pecans”, “chocolate”, “cherries” ] } ..

Read more

This is the case. mongodb under Ubuntu uses everything normally. It turns on authentication. Users created by using it use everything normally and can be verified. The following information shows the three users I created. When using it, it is normally connected (nodejs connection), but when it comes to data backup, it will not work. ..

Read more

I want to restore a single table, so write the command mongorestore –username admin –password “pwdmongo” –db poi –collection newPoi newPoi.bson But always prompt for errors connected to: 127.0.0.1 assertion: 18 { ok: 0.0, errmsg: “auth failed”, code: 18, codeName: “AuthenticationFailed” } First of all, the problem definitely lies in trying to remove double quotation ..

Read more

In the background, I checked that there are multiple indexes for a table in the database. I built a new table. Is there any way to add all the indexes Try: var indexes = db.user.getIndexes(); indexes.forEach(function(index){ delete index.v; delete index.ns; var options = []; for (var option in index) { if (option ! = ‘key’) ..

Read more

Operation database file: projectDao.js var mongoose = require(‘mongoose’) const Project = mongoose.model(‘Project’) exports.createProject = async(data) => { data.m.projectModelId=data.m.projectModel.split(‘,’)[0] data.m.projectModelName=data.m.projectModel.split(‘,’)[1] delete data.m.projectModel let project = new Project(data.m) let flag1= false let flag2=false let flag3=false await project.save(function (err) { if (err) { flag1 = false return console.error(err) }else{ flag1=true return Promise.resolve(flag1) } }) console.log(flag1) let formModels = ..

Read more

See on the InternetView all indexes in the database db.system.indexes.find ()db.system.indexes.find() Why is it like this after I enter it This command should be input under mongodb’s shell, not under the operating system’s shell. First, execute mongo and input various mongodb commands,..

Read more

Demand What other brands are mentioned when one brand is mentioned in the query statisticsAt present, the brand is preserved in MongoDB in this way. “brands” : [ “Siemens”, “ABB”, “GE” ], Obviously, this structure is difficult to meet the above query requirements. The following structure is required to support this query requirement “brand_and_mentioned_brands”:[ { ..

Read more

After reading a tutorial, mongod is used to start the system, and dbpath is used to set the storage path of database files. But mongodb that I downloaded is configured like this In this way, every time I just need to start mongodb’s service, and then enter it after cmd directly enters mongo, I don’t ..

Read more

I first backup data from the local LAN to the local, the command is as follows:mongodump -h 192.168.1.253 –port 27017 -d SmallPark -o /home/guo/mon2Then restore the local data to Amazon servermongorestore -h 52.80.84.86 –port 27017 -d SmallPark –drop /home/guo/mon/SmallParkHowever, this kind of mistake will be reported when recovery is made.Error creating index SmallPark.parkusers: 197 err: ..

Read more