如何解决我需要一些有关将sql sb转换为mongodb的建议
此MysqL代码,这是将其转换为mongDB的json的最佳方法, 作为具有每个集合中每个集合的id属性的独立集合,例如关系数据库,或 这样为每个用户创建一个大集合。
我是mongo db的新手,所以我很乐意提供有关如何执行此操作的建议。
{
"iddpt": 1,"dpt": "A1","user": {
"fisrt": "Juan","second": "","last": "Perez",}
"2020": {
"jan": {
"id_concep": 1,"date": '2020-01-01',"paydate": '2020-01-01',"amount": 3000,"interes": 0,"desceunto": 0,"cantidadpagada": 3000,"generado": '2020-01-01'
}
"feb": {
"id_concep": 1,"generado": '2020-01-01'
}
"mar": {
"id_concep": 1,"generado": '2020-01-01'
}
"apr": {
"id_concep": 1,"generado": '2020-01-01'
}
"may": {
"id_concep": 1,"generado": '2020-01-01'
}
"jun": {
"id_concep": 1,"generado": '2020-01-01'
}
"jul": {
"id_concep": 1,"generado": '2020-01-01'
}
"aug": {
"id_concep": 1,"generado": '2020-01-01'
}
"sep": {
"id_concep": 1,"generado": '2020-01-01'
}
"oct": {
"id_concep": 1,"generado": '2020-01-01'
}
"nov": {
"id_concep": 1,"generado": '2020-01-01'
}
"dic": {
"id_concep": 1,"generado": '2020-01-01'
}
"enero": {
"id_concep": 2,"generado": '2020-01-01'
}
}
"activo": 1,"generado": '2020-01-01',}
我还有另一个问题,我该如何用1补充500的另一笔收入
id_concep=2 like this
"jan": {
"id_concep": 2,"date": '2020-01-10',"paydate": '2020-01-10',"amount": 500,"cantidadpagada": 500,"generado": '2020-01-10'
}
非常感谢您....
-- ----------------------------
-- Table structure for tbl_dpts
-- ----------------------------
CREATE TABLE `tbl_dpts` (
`iddpt` smallint(6) NOT NULL AUTO_INCREMENT,`dpt` varchar(50) DEFAULT NULL,PRIMARY KEY (`iddpt`)
) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;
INSERT INTO `tbl_dpts` VALUES ('1','A1');
INSERT INTO `tbl_dpts` VALUES ('2','A2');
INSERT INTO `tbl_dpts` VALUES ('3','A3');
-- ----------------------------
-- Records of tbl_usuarios
-- ----------------------------
CREATE TABLE `tbl_usuarios` (
`idusuarios` smallint(6) NOT NULL AUTO_INCREMENT,`iddpt` smallint(6) DEFAULT '0',`nombre` varchar(20) DEFAULT NULL,`segundo` varchar(20) DEFAULT NULL,`paterno` varchar(20) DEFAULT NULL,`materno` varchar(20) DEFAULT NULL,`activo` char(1) DEFAULT '1',`generado` timestamp NULL DEFAULT CURRENT_TIMESTAMP,PRIMARY KEY (`idusuarios`)
) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;
INSERT INTO `tbl_usuarios` VALUES ('1','1','JaimE','','FERNANDEZ','2019-07-11 20:25:15');
INSERT INTO `tbl_usuarios` VALUES ('2','2','JUAN','PEREZ','2019-07-11 20:25:15');
INSERT INTO `tbl_usuarios` VALUES ('3','3','LUIS','GOMES','2019-07-11 20:25:15');
-- ----------------------------
-- Table structure for tbl_ingresos
-- ----------------------------
CREATE TABLE `tbl_ingresos` (
`idingreso` int(11) NOT NULL AUTO_INCREMENT,`idconcep` int(6) DEFAULT '0',`id_dpt` int(6) DEFAULT '0',`date` date DEFAULT NULL,`paydate` date DEFAULT NULL,`amount` float DEFAULT NULL,`interes` float DEFAULT NULL,`descuento` float DEFAULT NULL,`cantidadpagada` float DEFAULT NULL,PRIMARY KEY (`idingreso`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
INSERT INTO `tbl_ingresos` VALUES ('1','2000-01-01','3000','0','');
INSERT INTO `tbl_ingresos` VALUES ('1','2000-02-01','2000-03-01','2000-04-01','2000-05-01','2000-06-01','2000-07-01','2000-08-01','2000-09-01','2000-10-01','2000-11-01','2000-12-01','');
INSERT INTO `tbl_ingresos` VALUES ('1','');
-- ----------------------------
-- Table structure for tbl_ingresos_conceptos
-- ----------------------------
CREATE TABLE `tbl_ingresos_conceptos` (
`id_concep` int(6) NOT NULL AUTO_INCREMENT,`concepto` varchar(255) DEFAULT NULL,PRIMARY KEY (`id_concep`)
) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of tbl_ingresos_conceptos
-- ----------------------------
INSERT INTO `tbl_ingresos_conceptos` VALUES ('1','MANTENIMIENTO','2');
INSERT INTO `tbl_ingresos_conceptos` VALUES ('2','RENTA','2');
INSERT INTO `tbl_ingresos_conceptos` VALUES ('3','VENTA','2');
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。