Mongoexport query

262 views
Skip to first unread message

hyndavi Marella

unread,
Jul 30, 2016, 1:25:43 AM7/30/16
to mongodb-user
Hi

I am unable to export the mongo db dump for  a specific query string

Please help


mongoexport --host ebf-dev-rep/mndb-ebf-dev-01.cisco.com:27048

,mngdb-ebf-dev-02.cisco.com:27048,mngdb-ebf-dev-03.cisco.com:27048 --username device_user --password mongo123 --db device_db --collection devices --query '{"entitlement_type":"FEATUREHASH"}' --out device.csv


Asya Kamsky

unread,
Aug 2, 2016, 8:36:42 PM8/2/16
to mongodb-user
What error do you get?


--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
 
For other MongoDB technical support options, see: https://docs.mongodb.com/manual/support/
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user...@googlegroups.com.
To post to this group, send email to mongod...@googlegroups.com.
Visit this group at https://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/769d7b80-010f-4ab9-ab2a-243efbbeebdd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Asya Kamsky
Lead Product Manager
MongoDB
Download MongoDB - mongodb.org/downloads
Free MongoDB Monitoring - cloud.mongodb.com
Free Online Education - university.mongodb.com
Get Involved - mongodb.org/community
We're Hiring! - https://www.mongodb.com/careers

hyndavi Marella

unread,
Aug 9, 2016, 3:17:56 AM8/9/16
to mongodb-user

hyndavi Marella

unread,
Aug 9, 2016, 3:20:21 AM8/9/16
to mongodb-user

mongoexport --host <hostdetails> --username <usename>--password <pwd> --db device_db --collection devices --query '{"entitlement_type":"FEATUREHASH"}' --out device.csv

 
the above is the query I use:
 
error :
syntax error for the expression query

On Tuesday, August 2, 2016 at 5:36:42 PM UTC-7, Asya Kamsky wrote:

William Hagan

unread,
Aug 12, 2016, 5:06:07 AM8/12/16
to mongodb-user
Hi,

Can you try making use of the "equal to" symbol "=" when using the full name of the options?

For example, where you have "--host <hostdetails>", you write "--host=<hostdetails>"

Using the example query you provided, try this:
mongoexport --host=<hostdetails> --username=<usename> --password=<pwd> --db=device_db --collection=devices --query='{"entitlement_type":"FEATUREHASH"}' --out=device.csv

Cheers

hyndavi Marella

unread,
Sep 8, 2016, 2:22:40 AM9/8/16
to mongodb-user


Above is the error received when = option was given.
Auto Generated Inline Image 1

Muhammet Arıkaya

unread,
Sep 8, 2016, 10:44:47 AM9/8/16
to mongodb-user
give the query like this

--query "{currentMonthOutgoingActivyDate : {$gt : 0}}" 

30 Temmuz 2016 Cumartesi 08:25:43 UTC+3 tarihinde hyndavi Marella yazdı:

John Murphy

unread,
Sep 15, 2016, 9:21:27 PM9/15/16
to mongodb-user

Hi Hyndavi,

As you are using the MongoDB tools in a Windows environment can you use the following query string:

mongoexport --host ebf-dev-rep/mndb-ebf-dev-01.cisco.com:27048,mngdb-ebf-dev-02.cisco.com:27048,mngdb-ebf-dev-03.cisco.com:27048 
            --username <username> --password <password> --db device_db --collection devices 
            --query "{'entitlement_type':'FEATUREHASH'}" --out device.csv

The double quotes are used to surround the entire query string while the single quotes are used to surround the key and value strings.

Regards,
John Murphy

Reply all
Reply to author
Forward
0 new messages