리그캣의 개발놀이터

mongo db collection 접근 에러 본문

프로그래밍 기본/서버 구축 및 관리

mongo db collection 접근 에러

리그캣 2019. 7. 16. 15:17

누군가가 해당 mongodb collection 이름을 숫자를 넣어서 만들어놨는데...

 

해당 collection에 관한 명령어를 치면 다음과 같은 에러를 보냈다.

 

2019-07-16T15:11:32.925+0900 E QUERY    [js] SyntaxError: missing ; before statement @(shell):1:23

 

 

이럴땐 다음과 같이 접근해야한다.

 

콜렉션 명이 3mLgQAYJCq6_20110802라면

db["3mLgQAYJCq6_20110802"].command()

 

예를들면 

db["3mLgQAYJCq6_20110802"].findOne();

db["3mLgQAYJCq6_20110802"].drop();

 

 

https://stackoverflow.com/questions/7111830/cant-access-collection-from-the-shell-syntaxerror-missing-before-statement

Comments