0

when I input

DB.prototype

the mongodb shell said

undefined

But when i input

DB.prototype.dropDatabase

It return the source code of the method 'dropDatabase'. So,what the prototype means?So does DB?

Neil Lunn
  • 148,042
  • 36
  • 346
  • 317
lxacoder
  • 191
  • 1
  • 11
  • 2
    What you are doing is typing into the [mongo](https://docs.mongodb.com/manual/reference/mongo-shell/) shell. This is a JavaScript based REPL environment and therefore all the methods conform to JavaScript objects. This has nothing to do with MongoDB itself, but is simply an artifact of using a JavaScript REPL as a vehicle for implementing a command execution environment. – Neil Lunn May 26 '17 at 04:43
  • I know little about JavaScript.May prototype is just a JavaScript objcets? @NeilLunn – lxacoder May 26 '17 at 10:09

0 Answers0