第一次连接后再次连接到MongoDB?

时间:2016-06-30 14:11:35

标签: javascript node.js mongodb database nosql

在我与mongo db的第二次连接中(我处理POST数据),assert抛出一个错误。 我是这个话题的新手,也许我忘了在服务器端考虑一些事情?但重新启动mongo服务器也没有解决方案。

基本上,我想将用户输入插入到集合中。不知道错误在哪里,任何人?

mysql> select DONATUR,COUNT(DISTINCT AREA) ,@curRank := @curRank + 1 AS rank from funding,(SELECT @curRank := 0) r group by Donatur;               +---------+----------------------+------+
| DONATUR | COUNT(DISTINCT AREA) | rank |
+---------+----------------------+------+
| Mr.X    |                    3 |    1 |
| Mr.Y    |                    1 |    2 |
| Mr.Z    |                    2 |    3 |
| sss     |                    0 |    4 |
| wwww    |                    0 |    5 |
+---------+----------------------+------+
5 rows in set (0.00 sec)

 SELECT x.DONATUR,x.area,if(x.rank>y.rank,y.rank,x.rank) AS rank FROM (select DONATUR,COUNT(DISTINCT AREA) as area ,@curRank := @curRank + 1 AS rank from funding,(SELECT @curRank := 0) r group by Donatur) x LEFT JOIN  (select DONATUR,COUNT(DISTINCT AREA) as area ,@curRank2 := @curRank2 + 1 AS rank from funding,(SELECT @curRank2 := 0) r group by Donatur) y on y.rank<>x.rank and x.area=y.area;
+---------+------+------+
| DONATUR | area | rank |
+---------+------+------+
| Mr.X    |    3 |    1 |
| Mr.Y    |    1 |    2 |
| Mr.Z    |    2 |    3 |
| sss     |    0 |    4 |
| wwww    |    0 |    4 |
+---------+------+------+
5 rows in set (0.00 sec)

0 个答案:

没有答案