Practica mongoDB: CreateDB, DropDB, CreateCollection, DropDB, Insert.









Microsoft Windows [Version 10.0.18362.295]
(c) 2019 Microsoft Corporation. All rights reserved.

C:\Users\Windows10>mongo
MongoDB shell version v4.2.0
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
Implicit session: session { "id" : UUID("697c54ef-adce-4280-aaf0-0ffd48b2537c") }
MongoDB server version: 4.2.0
Server has startup warnings:
2019-09-10T14:13:49.966-0500 I  CONTROL  [initandlisten]
2019-09-10T14:13:49.966-0500 I  CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.
2019-09-10T14:13:49.967-0500 I  CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.
2019-09-10T14:13:49.967-0500 I  CONTROL  [initandlisten]
2019-09-10T14:13:49.967-0500 I  CONTROL  [initandlisten] ** WARNING: This server is bound to localhost.
2019-09-10T14:13:49.967-0500 I  CONTROL  [initandlisten] **          Remote systems will be unable to connect to this server.
2019-09-10T14:13:49.968-0500 I  CONTROL  [initandlisten] **          Start the server with --bind_ip <address> to specify which IP
2019-09-10T14:13:49.968-0500 I  CONTROL  [initandlisten] **          addresses it should serve responses from, or with --bind_ip_all to
2019-09-10T14:13:49.968-0500 I  CONTROL  [initandlisten] **          bind to all interfaces. If this behavior is desired, start the
2019-09-10T14:13:49.968-0500 I  CONTROL  [initandlisten] **          server with --bind_ip 127.0.0.1 to disable this warning.
2019-09-10T14:13:49.969-0500 I  CONTROL  [initandlisten]
---
Enable MongoDB's free cloud-based monitoring service, which will then receive and display
metrics about your deployment (disk utilization, CPU, operation statistics, etc).

The monitoring data will be available on a MongoDB website with a unique URL accessible to you
and anyone you share the URL with. MongoDB may use this information to make product
improvements and to suggest MongoDB products and deployment options to you.

To enable free monitoring, run the following command: db.enableFreeMonitoring()
To permanently disable this reminder, run the following command: db.disableFreeMonitoring()
---

> use Ramsesdata
switched to db Ramsesdata
> db.subordinados.insert({id:"!", Nombre:"Rames Jared Garcia Trevino", Puesto:"Limpieza", Sueldo:"300"})
WriteResult({ "nInserted" : 1 })
> db.subordinados.insert({id:"2", Nombre:"Pedro Fernandez Osorio", Puesto:"Seguridad", Sueldo:"300"})
WriteResult({ "nInserted" : 1 })
> db
Ramsesdata
> show collections
subordinados
> db.subordinados.find().pretty()
{
        "_id" : ObjectId("5d77f7c271baeef74ecdf56d"),
        "id" : "!",
        "Nombre" : "Rames Jared Garcia Trevino",
        "Puesto" : "Limpieza",
        "Sueldo" : "300"
}
{
        "_id" : ObjectId("5d77f7f771baeef74ecdf56e"),
        "id" : "2",
        "Nombre" : "Pedro Fernandez Osorio",
        "Puesto" : "Seguridad",
        "Sueldo" : "300"
}
> db.dropRamsesdata()
2019-09-10T14:25:59.211-0500 E  QUERY    [js] uncaught exception: TypeError: db.dropRamsesdata is not a function :
@(shell):1:1
> db
Ramsesdata
> db.dropDatabase()
{ "dropped" : "Ramsesdata", "ok" : 1 }
>
>











Comentarios

Entradas populares de este blog

Crear Usuario y contrasena en MONGODB

5.4 Métodos de recuperación de un SGBD.