简体   繁体   中英

Issues with VS Code, Azure Cosmos DB and MongoDB

Playing with Mongodb and VSCode, im connected via a scrapbook to a docker instance of mongodb (4.04) but any basic queries are failing,

Ie if i run

USE Admin

I get the error:

at 1:1: Error near line 0, column 0: mismatched input 'use' expected <EOF>' Please check syntax

and when i try to create a user following mongodb documentation from: https://docs.mongodb.com/manual/tutorial/enable-authentication/

I get the use error above, if i remove that i get an error saying:

db.createUser at 2:1 Error near line 5, column 45: 'mismatched input 'db' expecting '}". Please check syntax

but i can get things like below to work successfully!

db.getCollection.find()

EDIT ******

Just installed mongodb community edition of 4.0 (without the server) so i can use the mongo shell. Everything works in the shell but fails in VS!? pics below

在此处输入图片说明 在此处输入图片说明

I'm guessing you're typing in capital letters, because if I try:

USE Admin

2018-11-30T12:43:57.089+0100 E QUERY [thread1] SyntaxError: missing ; before statement @(shell):1:4

But:

use Admin

switched to db Admin

I'm pretty sure it's the same kind of error for the second one.

A lot of systems are case-sensitive, which is a reasonable default because A and a are not the same character (in term of character encoding, not in term of a human reading it).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM