常用加索引-命令举例:
db.getCollection('s_statistics_player_amt').createIndex({target_type:1,target_id:1,team_id:1},{name: "target_type_1_target_id_1_team_id_1",background: true});
db.getCollection('b_statistics_player').createIndex({player_id:1,target_type:1},{name: "player_id_1_target_type_1",background: true});
1.mongo是文档型数据库,不能join
2.mongosql语法文档:
3,mongo执行计划语法文档:
mongodb explain("executionStats")
Mongodb索引及explain:
Mongodb索引及explain_executionstats.executionstages.inputstage_qq_41084438的博客-CSDN博客
4.代码中使用JDBC
MongoDB使用JDBC连接_mongodb jdbc_Jwbasta的博客-CSDN博客
5.mongo补数据, 用客户端手动补数据
用其他表的数据来补数据
把文档名称改为 想补数据的 目的表的表名
5.报错排查处理
com.mongodb.MongoCommandException: Command failed with error 18 (AuthenticationFailed): 'Authentication failed.' on server localhost:27017. The full response is { "ok" : 0.0, "errmsg" : "Authentication failed.", "code" : 18, "codeName" : "AuthenticationFailed" }
这个最后排查结果为: 我程序的连接数据库的账号密码被改了, 密码错误