Federico Spaghetti
Federico Spaghetti

Reputation: 124

How to run couchbase n1ql-command from powershell

I'm trying to extract all the documents from a bucket and pipe them out to a file. I'm running this commmand:

PS C:\Program Files\Couchbase\Server\bin> ./cbq --engine couchbase://localhost --user Administrator --password 'password' --script="SELECT * FROM `bucket.name`"

But Powershell expects something more and gives me newlines with >> at the start of each line after executing the command.

If I drop the --script=... I log into the cqb-shell, and running the command/script works fine, but piping to file becomes difficult.

Do anyone have an idea of what's missing here? And how I can run the command from the terminal?

PS C:\Program Files\Couchbase\Server\bin> ./cbq -v SHELL VERSION : 2.0 on Couchbase Community Edition 6.0.0 build 1693

Upvotes: 1

Views: 816

Answers (2)

Federico Spaghetti
Federico Spaghetti

Reputation: 124

The answer came in the comments:

Put double back ticks around the bucket name, since the single back tick escaped the double quote

PS C:\Program Files\Couchbase\Server\bin> ./cbq --engine couchbase://localhost --user Administrator --password 'password' --script="SELECT * FROM ``bucket.name``"

Upvotes: 0

Related Questions