小编Ann*_*nie的帖子

mongoexport 错误:失败:无法解析 + 无法识别的字段'快照

目标:将我的本地 mongodb 数据迁移到 mongodb atlas 集群。

尝试:
1. 将本地数据导出为 json。
2.导入json到集群。

操作系统:Linuxmint 19.1 Cinnamon
mongo --version MongoDB shell version v4.0.10
mongod --version db version v3.6.3
我还有一个单独的数据库文件夹。

所以首先我开始

/home/me/mongodb/bin/mongod --dbpath=/home/me/mongodb-data
Run Code Online (Sandbox Code Playgroud)

然后我打开一个终端并输入

~/mongodb/bin $ mongoexport  --db task-manager --collection users --out ~/Desktop/test.json
Run Code Online (Sandbox Code Playgroud)

我希望任务管理器数据库中的用户集合将打印为 test.json 文件,但出现错误:

2019-06-18T22:05:06.108+0200    connected to: localhost
2019-06-18T22:05:06.108+0200    Failed: Failed to parse: { find: "users", filter: {}, sort: {}, skip: 0, snapshot: true, $readPreference: { mode: "secondaryPreferred" }, $db: "task-manager" }. Unrecognized field 'snapshot'.
Run Code Online (Sandbox Code Playgroud)

出了什么问题,我应该怎么做才能解决它?有没有更好的方法来迁移数据?

data-migration database-migration mongodb mongoexport

7
推荐指数
2
解决办法
8642
查看次数

How to store jwt in cookie and pass it to authentication function when redirecting a page?

I have a node.js express backend built with Postman and tested with Jest. I wrote a front end with hbs and the next step is to stitch them. However I still keep getting "please authenticate" error message that's from my auth function, which I guess is because I'm not successfully passing my jwt token.

So on login page (users/login) I want to login with email and password then I want to redirect to me page(users/me) where I can perform other …

node.js express jwt handlebars.js postman

6
推荐指数
1
解决办法
1万
查看次数

为什么我的 Webpack-cleanup-plugin 会删除我的排除文件?

背景:一个简单的单页React应用程序+ Redux + Express(以便上传到Heroku)。
我的公共文件夹中已经有index.html 和images 文件夹。我想运行 webpack 来生成我在 index.html 中使用的 styles.css 和 bundle.js。我想使用 webpack-clean-up-plugin 在每次运行构建时删除额外的先前文件,但我不希望这影响像 index.html 和 images 文件夹这样的东西。
根据文档: *选项 如果您想在输出路径中保留某些文件,例如从其他插件生成的 stats.json 文件,请使用排除数组选项。它接受小型匹配中的通配符。

// 不要删除stats.json, important.json, 以及其中的所有内容folder

new WebpackCleanupPlugin({
  exclude: ["stats.json", "important.js", "folder/**/*"],
})
Run Code Online (Sandbox Code Playgroud)

目标:运行 webpack.prod.js 所以最后 public 文件夹有

  • 索引.html
  • 捆绑包.js
  • Bundle.js.map
  • 样式.css
  • 样式.css.地图
  • 图片(文件夹)

Webpack.config.prod.js

const { CleanWebpackPlugin } = require('clean-webpack-plugin')  
output: {
        path: path.join(__dirname, 'public'),
        filename: 'bundle.js'
    }, 
    plugins: [
        new MiniCssExtractPlugin({ 
            filename: "styles.css", 
            chunkFilename: "[id].css"}),
         new CleanWebpackPlugin({
         exclude: …
Run Code Online (Sandbox Code Playgroud)

webpack webpack-plugin

4
推荐指数
1
解决办法
1万
查看次数