The strange question of the burial of the former MongoDB

Source: Internet
Author: User
Tags findone

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

Related Article

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.