How can I initialize the MongoDB -bject database in the browser console?

Suppose I want to execute 'db.things.insert({colors : ["blue", "black"]})'in a browser. I can execute it in the Mongodb shell, but I don’t yet understand how to execute it, for example: open the Google Chrome console, initialize the DB object with some connection and execute the command. Is there any plugin? Sorry, I am completely new to MongoDB, trying to quickly check all things using the browser shell. How can I initialize?

Trial 0: maybe with a REST-interface?

I turned on REST using "$ echo 'rest=true' > /etc/mongodb.conf; $ sudo restart mongodb"works in Ubuntu. More about the rest    here , I’m not sure if it’s necessary here, but maybe with some POST / REST method I can initialize.

Litigation 1: Oreus Book of MongoDB and 50 Tips (p. 47)

The book gives an example

> db = connect ("ny1a:27017/foo")
> db = connect ("ny1a:27017/admin")
     

so now

> db=connect("localhost:27017/test")
ReferenceError: connect is not defined
     

Yes, because I need to specify a command connect, some additional examples are here , where can I get it?

Ps I am studying this tutorial here .

0
source share
1 answer

You cannot just access mongodb from the browser console. Your browser is a client, and there is no (to my knowledge) javascript client side library. Any javascript library you find is likely to be for Node.js (server).

mongo - . javascript, mongo. connect - mongo.

REST mongod, HTTP- REST. : http://localhost:28017/ , , . . http://www.mongodb.org/display/DOCS/Http+Interface#HttpInterface-SimpleRESTInterface

. REST . .

, .

0

All Articles