mongodb error: E QUERY Syntaxerror: Unexpected Identifier

Asked

Viewed 165 times

0

I am trying to use mongodb for the first time and did the installation using Macports after that.

In a terminal run the mongod. In another run the command Mongo.

in the Mongo terminal I try to execute the import command but cannot, give the following error already quoted in the question title.

E QUERY Syntaxerror: Unexpected Identifier

my server is going up with the following message:

2015-11-14T23:33:09.540-0200 E NETWORK  [initandlisten] listen(): bind() failed errno:48 Address already in use for socket: 0.0.0.0:27017
2015-11-14T23:33:09.541-0200 E NETWORK  [initandlisten]   addr already in use
2015-11-14T23:33:09.581-0200 I JOURNAL  [initandlisten] journal dir=/data/db/journal
2015-11-14T23:33:09.581-0200 I JOURNAL  [initandlisten] recover : no journal files present, no recovery needed
2015-11-14T23:33:09.628-0200 I JOURNAL  [durability] Durability thread started
2015-11-14T23:33:09.628-0200 I JOURNAL  [journal writer] Journal writer thread started
2015-11-14T23:33:09.628-0200 I CONTROL  [initandlisten] MongoDB starting : pid=1302 port=27017 dbpath=/data/db 64-bit host=MacBookPro-HeltonWebDeveloper.local
2015-11-14T23:33:09.628-0200 I CONTROL  [initandlisten] 
2015-11-14T23:33:09.629-0200 I CONTROL  [initandlisten] ** WARNING: soft rlimits too low. Number of files is 256, should be at least 1000
2015-11-14T23:33:09.629-0200 I CONTROL  [initandlisten] db version v3.0.7
2015-11-14T23:33:09.629-0200 I CONTROL  [initandlisten] git version: nogitversion
2015-11-14T23:33:09.629-0200 I CONTROL  [initandlisten] build info: Darwin MacBookPro-HeltonWebDeveloper.local 15.0.0 Darwin Kernel Version 15.0.0: Wed Aug 26 16:57:32 PDT 2015; root:xnu-3247.1.106~1/RELEASE_X86_64 x86_64 BOOST_LIB_VERSION=1_59
2015-11-14T23:33:09.629-0200 I CONTROL  [initandlisten] allocator: system
2015-11-14T23:33:09.629-0200 I CONTROL  [initandlisten] options: {}
2015-11-14T23:33:09.999-0200 I CONTROL  [initandlisten] now exiting
2015-11-14T23:33:09.999-0200 I NETWORK  [initandlisten] shutdown: going to close listening sockets...
2015-11-14T23:33:09.999-0200 I NETWORK  [initandlisten] shutdown: going to flush diaglog...
2015-11-14T23:33:09.999-0200 I NETWORK  [initandlisten] shutdown: going to close sockets...
2015-11-14T23:33:09.999-0200 I STORAGE  [initandlisten] shutdown: waiting for fs preallocator...
2015-11-14T23:33:09.999-0200 I STORAGE  [initandlisten] shutdown: final commit...
2015-11-14T23:33:10.011-0200 I JOURNAL  [initandlisten] journalCleanup...
2015-11-14T23:33:10.011-0200 I JOURNAL  [initandlisten] removeJournalFiles
2015-11-14T23:33:10.011-0200 I JOURNAL  [initandlisten] Terminating durability thread ...
2015-11-14T23:33:10.107-0200 I JOURNAL  [journal writer] Journal writer thread stopped
2015-11-14T23:33:10.107-0200 I JOURNAL  [durability] Durability thread stopped
2015-11-14T23:33:10.107-0200 I STORAGE  [initandlisten] shutdown: closing all files...
2015-11-14T23:33:10.108-0200 I STORAGE  [initandlisten] closeAllFiles() finished
2015-11-14T23:33:10.108-0200 I STORAGE  [initandlisten] shutdown: removing fs lock...
2015-11-14T23:33:10.108-0200 I CONTROL  [initandlisten] dbexit:  rc: 48
  • Sounds like syntax error, which command are you using exactly? Remembering that you should use mongoimport directly on your terminal and not inside the command shell mongo.

  • @Olimonf. yes exactly, beginner error but I already did a search for about 3 hours and I know I needed to run in another terminal but it did not work can help me with other guidance.

  • what command is running? checked in Jslint if your JSON is valid? @heltonss

  • Yes all quiet... I updated the question with the message from the mongod server.

1 answer

0

The server log you posted does not seem to have anything to do with the original error. The log probably indicates that there is another mongodb active on the same port. Either you choose another port, or use the active Ngo, or finish it and run the new.

After this problem, try again the failed command.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.