Mongodb

The system doesn’t response the link from the validate url, and no user has sign up as validate user. And from the code, I do not know which account name and password can be used as admin (actually not admin). Then I think that I should modify the property in the mongodb to change the property of active from false to true. Then the system will be deceived and consider the login name as a validate account.

Open the shell of mongodb:
sudo mongo

help command to see the executable comand:
help

show dbs show database names
show collections show collections in current database

use set current database
db.foo.find() list objects in collection foo

in this project:
use node_club_dev
db.users.find()

Then it shows all the records in collection users.

If execute the command:
db.users.findAndModify({query:{“loginname”:”admin”},update:{“receive_at_mail” : true, “receive_reply_mail” : true, “active”:true},upsert: false})

It will produce errors:
Error: findAndModifyFailed failed: {
“errmsg” : “exception: E11000 duplicate key error index: node_club_dev.users.$loginname_1 dup key: { : null }”,
“code” : 11000,
“ok” : 0
}
at Error ()
at DBCollection.findAndModify (src/mongo/shell/collection.js:636:15)
at (shell):1:10 at src/mongo/shell/collection.js:636

Saying that duplicate key error.
So change to
db.users.findAndModify({query:{“loginname”:”admin”},update:{ “email” : “ff.dd@tom.com”,”loginname”:”admin”,”active”:true}})

Adding the loggin name to the modify field, then error disappear, and the property changed.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s