Is there a simple way to export the data from a meteor deployed app?

后端 未结 12 2120
轻奢々
轻奢々 2020-11-30 16:30

Is there a simple way to export the data from a meteor deployed app?

So, for example, if I had deployed an app named test.meteor.com...

How could I easily d

12条回答
  •  庸人自扰
    2020-11-30 17:11

    Based on Kasper Souren's solution I created an updated script that works with current versions of Meteor and also works when you protect your remote Meteor app with a password.

    Please create the following script parse-mongo-url.coffee:

    spawn = require('child_process').spawn
    mongo = spawn 'meteor', ['mongo', '--url', 'YOURPROJECT.meteor.com'], stdio: [process.stdin, 'pipe', process.stderr]
    
    mongo.stdout.on 'data', (data) ->
        data = data.toString()
        m = data.match /mongodb:\/\/([^:]+):([^@]+)@([^:]+):27017\/([^\/]+)/
        if m?
            process.stdout.write "-u #{m[1]} -p #{m[2]} -h #{m[3]} -d #{m[4]}"
        else
            if data == 'Password: '
                process.stderr.write data
    

    Then execute it like this in a *nix shell:

    mongodump `coffee parse-mongo-url.coffee`
    

提交回复
热议问题