Took over a very old project database with MongoDB
The collections table name in the code is auth.
Go straight to monogdb show table
I do have a auth watch.
Want to log in locally to see user information
> Db.auth.findOne ()
Thu Sep 14:26:03.829 typeerror:object function () {
var ex;
try {
This._authorthrow.apply (this, arguments);
} catch (ex) {
Print (ex);
return 0;
}
return 1;
} has no method ' FindOne '
It's weird.
and see
> Db.auth
function () {
var ex;
try {
This._authorthrow.apply (this, arguments);
} catch (ex) {
Print (ex);
return 0;
}
return 1;
}
What ghost, how all can not think of, this version MONGO too old, I thought is mongo of authority have what problem adduser,createuser around a circle
But the name of the table in the code is auth.
Why is it a function in the library?
It suddenly occurred to me that Auth was not the way of MONGO.
Db.getcollection ("auth"). FindOne ()
I saw the data.
Code MONGO driver The default getcollection ("Auth") to get the data
My personal habit in the shell is the same as the Db.tbname table name and the native method name, which is called the Auth method
And no matter what language programming without reserved words, no matter what db, not the original method name and keyword when the table name, it is common sense
The strange question of the burial of the former MongoDB