Está en la página 1de 13

UNIVERSIDAD ALAS

PERUANAS
FACULTAD DE INGENIERAS Y
ARQUITECTURA
ESCUELA PROFESIONAL DE INGENIERA DE SISTEMAS E INFORMTICA

NIVERSIDAD

LAS

ERUANAS

CARRERA PROFESIONAL DE
INGENIERIA DE SISTEMAS E
INFORMATICA
BASE DATOS TIENDA
MONGODB
CURSO: MODELAMIENTO E INTEGRACION DE
PROCESOS

INTEGRANTES
ZAMATA LIMA, OSCAR
PALOMINO TURPO, CARLOS

AREQUIPA-PERU
2016
ENTRAR A LA PAGINAS WEB Y DESCARGAR EL ARCHIVO PARA LA BASE DATOS
MONGODB
EN CASO MIO ES PARA WINDOWS 7 DE 64 BITS

INSTALACION DE LA BASE DATOS

SIGUIENTO CON LA INSTALACION DE LA BASE DE DATOS CON COMANDOS EN


CMD
Microsoft Windows [Versin 6.1.7600]
Copyright (c) 2009 Microsoft Corporation. Reservados todos los derechos.
C:\Users\Oscar>cd ..
C:\Users>cd ..
C:\>cd "C:\Program Files\MongoDB\Server\3.2\bin"
C:\Program Files\MongoDB\Server\3.2\bin>
C:\Program Files\MongoDB\Server\3.2\bin>dir
El volumen de la unidad C no tiene etiqueta.
El nmero de serie del volumen es: 7053-99AC
Directorio de C:\Program Files\MongoDB\Server\3.2\bin
19/04/2016 10:03 a.m. <DIR>
.
19/04/2016 10:03 a.m. <DIR>
..
13/04/2016 03:51 p.m.
4,776,960 bsondump.exe
13/04/2016 03:56 p.m.
10,021,376 mongo.exe
13/04/2016 04:00 p.m.
19,803,648 mongod.exe
13/04/2016 04:00 p.m.
162,172,928 mongod.pdb
13/04/2016 03:51 p.m.
26,982,400 mongodump.exe
13/04/2016 03:51 p.m.
6,539,776 mongoexport.exe
13/04/2016 03:51 p.m.
6,383,104 mongofiles.exe
13/04/2016 03:51 p.m.
6,662,656 mongoimport.exe
13/04/2016 03:51 p.m.
6,103,040 mongooplog.exe
13/04/2016 04:00 p.m.
17,082,368 mongoperf.exe
13/04/2016 03:51 p.m.
45,996,032 mongorestore.exe
13/04/2016 03:59 p.m.
8,369,152 mongos.exe
13/04/2016 03:59 p.m.
87,781,376 mongos.pdb
13/04/2016 03:51 p.m.
6,331,904 mongostat.exe
13/04/2016 03:51 p.m.
6,192,128 mongotop.exe
15 archivos 421,198,848 bytes
2 dirs 7,021,801,472 bytes libres
C:\Program Files\MongoDB\Server\3.2\bin>mongod
2016-04-19T10:09:51.482-0500 I CONTROL [main] Hotfix KB2731284 or later
update
is not installed, will zero-out data files
2016-04-19T10:09:51.485-0500 I CONTROL [initandlisten] MongoDB starting :
pid=2
572 port=27017 dbpath=C:\data\db\ 64-bit host=pc01
2016-04-19T10:09:51.485-0500 I CONTROL [initandlisten] targetMinOS:
Windows Vis
ta/Windows Server 2008
2016-04-19T10:09:51.485-0500 I CONTROL [initandlisten] db version v3.2.5

2016-04-19T10:09:51.486-0500 I CONTROL [initandlisten] git version:


34e65e5383f
7ea1726332cb175b73077ec4a1b02
2016-04-19T10:09:51.486-0500 I CONTROL [initandlisten] allocator: tcmalloc
2016-04-19T10:09:51.486-0500 I CONTROL [initandlisten] modules: none
2016-04-19T10:09:51.487-0500 I CONTROL [initandlisten] build environment:
2016-04-19T10:09:51.489-0500 I CONTROL [initandlisten]
distarch: x86_64
2016-04-19T10:09:51.489-0500 I CONTROL [initandlisten]
target_arch:
x86_64
2016-04-19T10:09:51.490-0500 I CONTROL [initandlisten] options: {}
2016-04-19T10:09:51.507-0500 I STORAGE [initandlisten] exception in
initAndList
en: 29 Data directory C:\data\db\ not found., terminating
2016-04-19T10:09:51.507-0500 I CONTROL [initandlisten] dbexit: rc: 100
C:\Program Files\MongoDB\Server\3.2\bin>mkdir \data\db
C:\Program Files\MongoDB\Server\3.2\bin>mongod
2016-04-19T10:12:56.364-0500 I CONTROL [main] Hotfix KB2731284 or later
update
is not installed, will zero-out data files
2016-04-19T10:12:56.366-0500 I CONTROL [initandlisten] MongoDB starting :
pid=2
44 port=27017 dbpath=C:\data\db\ 64-bit host=pc01
2016-04-19T10:12:56.366-0500 I CONTROL [initandlisten] targetMinOS:
Windows Vis
ta/Windows Server 2008
2016-04-19T10:12:56.366-0500 I CONTROL [initandlisten] db version v3.2.5
2016-04-19T10:12:56.366-0500 I CONTROL [initandlisten] git version:
34e65e5383f
7ea1726332cb175b73077ec4a1b02
2016-04-19T10:12:56.366-0500 I CONTROL [initandlisten] allocator: tcmalloc
2016-04-19T10:12:56.366-0500 I CONTROL [initandlisten] modules: none
2016-04-19T10:12:56.367-0500 I CONTROL [initandlisten] build environment:
2016-04-19T10:12:56.367-0500 I CONTROL [initandlisten]
distarch: x86_64
2016-04-19T10:12:56.368-0500 I CONTROL [initandlisten]
target_arch:
x86_64
2016-04-19T10:12:56.369-0500 I CONTROL [initandlisten] options: {}
2016-04-19T10:12:56.410-0500 I STORAGE [initandlisten] wiredtiger_open
config:
create,cache_size=1G,session_max=20000,eviction=(threads_max=4),config_
base=fals
e,statistics=(fast),log=(enabled=true,archive=true,path=journal,compressor=s
napp
y),file_manager=(close_idle_time=100000),checkpoint=(wait=60,log_size=2G
B),stati
stics_log=(wait=0),
2016-04-19T10:12:57.123-0500 I CONTROL [initandlisten]
2016-04-19T10:12:57.124-0500 I CONTROL [initandlisten] ** WARNING:
Insecure con
figuration, access control is not enabled and no --bind_ip has been specified.

2016-04-19T10:12:57.125-0500 I CONTROL [initandlisten] **


Read and
wri
te access to data and configuration is unrestricted,
2016-04-19T10:12:57.127-0500 I CONTROL [initandlisten] **
and the
serv
er listens on all available network interfaces.
2016-04-19T10:12:57.129-0500 I CONTROL [initandlisten]
2016-04-19T10:12:57.137-0500 I NETWORK
[HostnameCanonicalizationWorker] Startin
g hostname canonicalization worker
2016-04-19T10:12:57.138-0500 I FTDC
[initandlisten] Initializing full-time d
iagnostic data capture with directory 'C:/data/db/diagnostic.data'
2016-04-19T10:12:57.529-0500 I NETWORK [initandlisten] waiting for
connections
on port 27017
2016-04-19T12:22:55.988-0500 I NETWORK [initandlisten] connection
accepted from
127.0.0.1:13893 #1 (1 connection now open)
2016-04-19T12:56:53.675-0500 I COMMAND [conn1] command admin.$cmd
command: list
Databases { listDatabases: 1.0 } keyUpdates:0 writeConflicts:0 numYields:0
resle
n:109 locks:{ Global: { acquireCount: { r: 2 } }, Database: { acquireCount: { r:
1 } } } protocol:op_command 113ms
2016-04-19T14:00:23.858-0500 I NETWORK [initandlisten] connection
accepted from
127.0.0.1:20209 #2 (2 connections now open)
2016-04-19T14:05:54.340-0500 I COMMAND [conn2] command
TIENDA.productos command
: insert { insert: "productos", documents: [ { _id:
ObjectId('57168191cd0d8c99f2
5b334b'), nombre: "GLORIA" } ], ordered: true } ninserted:1 keyUpdates:0
writeCo
nflicts:0 numYields:0 reslen:25 locks:{ Global: { acquireCount: { r: 2, w: 2 } }
, Database: { acquireCount: { w: 1, W: 1 } }, Collection: { acquireCount: { W: 1
} } } protocol:op_command 679ms
2016-04-19T14:11:17.558-0500 I COMMAND [conn2] command
TIENDA.product command:
insert { insert: "product", documents: [ { _id:
ObjectId('571682d5cd0d8c99f25b33
4c'), nombre: "Gloria", descripcion: "Leche", precio: "1.50" } ], ordered: true
} ninserted:1 keyUpdates:0 writeConflicts:0 numYields:0 reslen:25 locks:
{ Global
: { acquireCount: { r: 2, w: 2 } }, Database: { acquireCount: { w: 1, W: 1 } },
Collection: { acquireCount: { w: 1, W: 1 } } } protocol:op_command 160ms
2016-04-19T14:13:51.615-0500 I COMMAND [conn2] command
TIENDA.product command:
find { find: "product", filter: {} } planSummary: COLLSCAN keysExamined:0
docsEx

amined:3 cursorExhausted:1 keyUpdates:0 writeConflicts:0 numYields:0


nreturned:3
reslen:361 locks:{ Global: { acquireCount: { r: 2 } }, Database: { acquireCount
: { r: 1 } }, Collection: { acquireCount: { r: 1 } } } protocol:op_command
131ms
2016-04-19T14:17:25.277-0500 I COMMAND [conn2] command
TIENDA.product command:
find { find: "product", filter: {}, limit: 1.0, singleBatch: true } planSummary:
COLLSCAN keysExamined:0 docsExamined:1 cursorExhausted:1 keyUpdates:0
writeConf
licts:0 numYields:0 nreturned:1 reslen:189 locks:{ Global: { acquireCount: { r:
2 } }, Database: { acquireCount: { r: 1 } }, Collection: { acquireCount: { r: 1
} } } protocol:op_command 118ms
2016-04-19T14:29:55.935-0500 I NETWORK [conn1] end connection
127.0.0.1:13893 (
1 connection now open)

CREACION DE PATH PARA LA EJECUCION DE MONGODB

Ejecutamos Mongod
Microsoft Windows [Versin 6.1.7600]
Copyright (c) 2009 Microsoft Corporation. Reservados todos los derechos.
C:\Users\Oscar>mongod
2016-04-19T10:28:17.416-0500 I CONTROL [main] Hotfix KB2731284 or later
update
is not installed, will zero-out data files
2016-04-19T10:28:17.417-0500 I CONTROL [initandlisten] MongoDB starting :
pid=5
548 port=27017 dbpath=C:\data\db\ 64-bit host=pc01
2016-04-19T10:28:17.417-0500 I CONTROL [initandlisten] targetMinOS:
Windows Vis
ta/Windows Server 2008
2016-04-19T10:28:17.417-0500 I CONTROL [initandlisten] db version v3.2.5
2016-04-19T10:28:17.417-0500 I CONTROL [initandlisten] git version:
34e65e5383f
7ea1726332cb175b73077ec4a1b02
2016-04-19T10:28:17.417-0500 I CONTROL [initandlisten] allocator: tcmalloc
2016-04-19T10:28:17.418-0500 I CONTROL [initandlisten] modules: none
2016-04-19T10:28:17.418-0500 I CONTROL [initandlisten] build environment:
2016-04-19T10:28:17.418-0500 I CONTROL [initandlisten]
distarch: x86_64
2016-04-19T10:28:17.418-0500 I CONTROL [initandlisten]
target_arch:
x86_64

2016-04-19T10:28:17.418-0500 I CONTROL [initandlisten] options: {}


2016-04-19T10:28:17.448-0500 E NETWORK [initandlisten] listen(): bind()
failed
errno:10048 Slo se permite un uso de cada direccin de socket
(protocolo/direcc
in de red/puerto) for socket: 0.0.0.0:27017
2016-04-19T10:28:17.448-0500 E STORAGE [initandlisten] Failed to set up
sockets
during startup.
2016-04-19T10:28:17.448-0500 I CONTROL [initandlisten] dbexit: rc: 48
C:\Users\Oscar>

Microsoft Windows [Versin 6.1.7600]


Copyright (c) 2009 Microsoft Corporation. Reservados todos los derechos.
C:\Users\Oscar>show dbs
"show" no se reconoce como un comando interno o externo,
programa o archivo por lotes ejecutable.
C:\Users\Oscar>mongo
2016-04-19T14:00:23.715-0500 I CONTROL [main] Hotfix KB2731284 or later
update
is not installed, will zero-out data files
MongoDB shell version: 3.2.5
connecting to: test
Server has startup warnings:
2016-04-19T10:12:57.123-0500 I CONTROL [initandlisten]
2016-04-19T10:12:57.124-0500 I CONTROL [initandlisten] ** WARNING:
Insecure con
figuration, access control is not enabled and no --bind_ip has been specified.
2016-04-19T10:12:57.125-0500 I CONTROL [initandlisten] **
Read and
wri
te access to data and configuration is unrestricted,
2016-04-19T10:12:57.127-0500 I CONTROL [initandlisten] **
and the
serv
er listens on all available network interfaces.
2016-04-19T10:12:57.129-0500 I CONTROL [initandlisten]
> use dbs
switched to db dbs
EN ESTA PARTE CREAMOS LA BASE DE DATOS
> use TIENDA
switched to db TIENDA
> db
TIENDA
EN ESTA PARTE INSERTAMOS EN LA COLECCIN PRODUCT 3 REGISTROS
> db.product.insert({nombre:"Gloria",descripcion:"Leche",precio:"1.50"})
WriteResult({ "nInserted" : 1 })
> db.product.insert({nombre:"Cocacola",descripcion:"Gaseosa",precio:"1.20"})
WriteResult({ "nInserted" : 1 })
> db.product.insert({nombre:"Soda",descripcion:"Galleta",precio:"1.20"})
WriteResult({ "nInserted" : 1 })
EN ESTA PARTE NO MUESTRA LA COLECCIN PRODUCT
> db.product.find()
{ "_id" : ObjectId("571682d5cd0d8c99f25b334c"), "nombre" : "Gloria",
"descripcio
n" : "Leche", "precio" : "1.50" }

{ "_id" : ObjectId("571682facd0d8c99f25b334d"), "nombre" : "Cocacola",


"descripc
ion" : "Gaseosa", "precio" : "1.20" }
{ "_id" : ObjectId("5716831ecd0d8c99f25b334e"), "nombre" : "Soda",
"descripcion"
: "Galleta", "precio" : "1.20" }
> db.product.find(1)
2016-04-19T14:14:31.689-0500 E QUERY [thread1] Error: don't know how to
massa
ge : number :
DBCollection.prototype._massageObject@src/mongo/shell/collection.js:218:11
DBCollection.prototype.find@src/mongo/shell/collection.js:266:1
@(shell):1:1
EN ESTA PARTE NOS MUESTRA EL PRIMER REGISTRO
> db.product.findOne()
{
"_id" : ObjectId("571682d5cd0d8c99f25b334c"),
"nombre" : "Gloria",
"descripcion" : "Leche",
"precio" : "1.50"
}
EN ESTA PARTE NOS MUESTRA EL SEGUNDO REGISTRO POR MEDIO DEL
NOMBRE
> db.product.find({nombre:"Cocacola"})
{ "_id" : ObjectId("571682facd0d8c99f25b334d"), "nombre" : "Cocacola",
"descripc
ion" : "Gaseosa", "precio" : "1.20" }
>

BIBLIOGRAFIA:
https://www.youtube.com/watch?v=1uFY60CESlM
http://mviera.io/blog/empezando-con-mongodb-part-ii/
http://mviera.io/blog/empezando-con-mongodb/