Learner
Learner

Reputation: 21393

SyntaxError with Mongo command

I am just started learning Mongo DB and wanted to insert some data in my DB. But I am getting errors:

Running below code gives me error in Mongo shell:

document = ( { "Type" : "Book", "Title" : "Definitive Guide to MongoDB 2nd ed.,", "ISBN" : "978-1-4302-5821-6", "Publisher" : "Apress", "Author": ["Hows, David", "Plugge, Eelco", "Membrey, Peter", “Hawkins, Tim” ] } )

E QUERY    SyntaxError: Unexpected token ILLEGAL

Can you please help me what is the issue with this code?

After creating the document I wanted to insert in my DB using command.

db.media.insert(document)

Upvotes: 0

Views: 114

Answers (1)

Ray Toal
Ray Toal

Reputation: 88378

In your code, at the end, you have

“Hawkins, Tim”

which should be

"Hawkins, Tim"

You have curly quotes instead of straight quotes.

Upvotes: 1

Related Questions