Вы находитесь на странице: 1из 2

Microsoft Windows [Version 10.0.18362.

356]
(c) 2019 Microsoft Corporation. All rights reserved.

C:\Users\ANIL>mongo "mongodb://cluster0-shard-00-00-dud1a.mongodb.net,cluster0-
shard-00-00-dud1a.mongodb.net:27017,cluster0-shard-00-00-
dud1a.mongodb.net:27017/video?replicaSet=Cluster0-shard-0" --ssl
--authenticationDatabase admin --username m001-student --password m001-mongodb-
basics
MongoDB shell version v3.4.21
connecting to: mongodb://cluster0-shard-00-00-dud1a.mongodb.net,cluster0-shard-00-
00-dud1a.mongodb.net:27017,cluster0-shard-00-00-dud1a.mongodb.net:27017/video?
replicaSet=Cluster0-shard-0
2019-09-17T14:16:38.753+0530 I NETWORK [thread1] Starting new replica set monitor
for Cluster0-shard-0/cluster0-shard-00-00-dud1a.mongodb.net:27017,cluster0-shard-
00-00-dud1a.mongodb.net:27017,cluster0-shard-00-00-dud1a.mongodb.net:27017
2019-09-17T14:16:40.003+0530 I NETWORK [thread1] Successfully connected to
cluster0-shard-00-00-dud1a.mongodb.net:27017 (1 connections now open to cluster0-
shard-00-00-dud1a.mongodb.net:27017 with a 5 second timeout)
2019-09-17T14:16:42.226+0530 I NETWORK [thread1] Successfully connected to
cluster0-shard-00-01-dud1a.mongodb.net:27017 (1 connections now open to cluster0-
shard-00-01-dud1a.mongodb.net:27017 with a 5 second timeout)
2019-09-17T14:16:42.498+0530 I NETWORK [thread1] changing hosts to Cluster0-shard-
0/cluster0-shard-00-00-dud1a.mongodb.net:27017,cluster0-shard-00-01-
dud1a.mongodb.net:27017,cluster0-shard-00-02-dud1a.mongodb.net:27017 from Cluster0-
shard-0/cluster0-shard-00-00-dud1a.mongodb.net:27017
2019-09-17T14:16:44.220+0530 I NETWORK [ReplicaSetMonitor-TaskExecutor-0]
Successfully connected to cluster0-shard-00-02-dud1a.mongodb.net:27017 (1
connections now open to cluster0-shard-00-02-dud1a.mongodb.net:27017 with a 5
second timeout)
MongoDB server version: 4.0.12
WARNING: shell and server versions do not match
Error while trying to show server startup warnings: user is not allowed to do
action [getLog] on [admin.]
MongoDB Enterprise Cluster0-shard-0:PRIMARY>
MongoDB Enterprise Cluster0-shard-0:PRIMARY> use db
switched to db db
MongoDB Enterprise Cluster0-shard-0:PRIMARY> use video
switched to db video
MongoDB Enterprise Cluster0-shard-0:PRIMARY> show collections
movieDetails
movieNames
video
MongoDB Enterprise Cluster0-shard-0:PRIMARY>
db.movieNames.updateOne({'name':'Avengers'},{$set{'name':'New Avengers'}})
2019-09-17T14:26:41.027+0530 E QUERY [thread1] SyntaxError: missing : after
property id @(shell):1:49
MongoDB Enterprise Cluster0-shard-0:PRIMARY>
db.movieNames.updateOne({'name':'Avengers'},{$set :{'name':'New Avengers'}})
{ "acknowledged" : true, "matchedCount" : 1, "modifiedCount" : 1 }
MongoDB Enterprise Cluster0-shard-0:PRIMARY> db.movieNames.updateOne({'name':'New
Avengers'},{'year':'2019'},{$set :{'name':'Extra New Avengers'},{'year':'1111'}})
2019-09-17T14:31:15.089+0530 E QUERY [thread1] SyntaxError: invalid property id
@(shell):1:101
MongoDB Enterprise Cluster0-shard-0:PRIMARY> db.movieNames.updateOne({'name':'New
Avengers'},{'year':'2019'},{$set :{'name':'Extra New Avengers','year':1902}})
2019-09-17T14:33:15.046+0530 E QUERY [thread1] Error: the update operation
document must contain atomic operators :
DBCollection.prototype.updateOne@src/mongo/shell/crud_api.js:524:1
@(shell):1:1
MongoDB Enterprise Cluster0-shard-0:PRIMARY> db.movieNames.updateOne({'name':'New
Avengers','year':2019},{$set :{'name':'Extra New Avengers','year':1902}})
{ "acknowledged" : true, "matchedCount" : 1, "modifiedCount" : 1 }
MongoDB Enterprise Cluster0-shard-0:PRIMARY> db.movieNames.updateOne({'year':'Extra
New Avengers'},{$set :{'name':'New Avengers'}})
{ "acknowledged" : true, "matchedCount" : 0, "modifiedCount" : 0 }
MongoDB Enterprise Cluster0-shard-0:PRIMARY>
db.movieNames.updateOne({'name':'jaadoo'},$set:{'year':2010})
2019-09-17T14:44:01.300+0530 E QUERY [thread1] SyntaxError: missing ) after
argument list @(shell):1:46
MongoDB Enterprise Cluster0-shard-0:PRIMARY>
db.movieNames.updateOne({'name':'jaadoo'},$set:{'year':2010}})
2019-09-17T14:44:07.182+0530 E QUERY [thread1] SyntaxError: missing ) after
argument list @(shell):1:46
MongoDB Enterprise Cluster0-shard-0:PRIMARY>
db.movieNames.updateOne({'name':'jaadoo'},{$set:{'year':2010}})
{ "acknowledged" : true, "matchedCount" : 1, "modifiedCount" : 1 }
MongoDB Enterprise Cluster0-shard-0:PRIMARY> ^C
bye

Вам также может понравиться