我可以/如何使用Postman连接到MLAB DB?

时间:2018-11-03 21:16:38

标签: node.js mongoose postman

也许我完全误解了这一点。我在本地和MLAB上都有一个dB,我已经用Robo3T连接到了Mlab DB,所以我看到数据库在那里,有4个集合,其中一个集合是假冒产品。

如果我在邮递员中,并且正在使用GET http://localhost:8080/products/ 内容类型application / json

它返回正确的响应3个项目。

当我尝试在以下位置向我的Mlab执行相同的Get请求时:

获取mongodb:// standarduser:thinkuser1@ds141613.mlab.com:41613 / grocerycompanion / products /

我得到:无法得到任何回应:

连接到mongodb:// standarduser:thinkuser1@ds141613.mlab.com:41613 / grocerycompanion / products /时出错。

我不确定自己在做什么错吗?

1 个答案:

答案 0 :(得分:2)

Postman不能仅使用mongo协议import pandas as pd import numpy as np np.random.seed(1) # Example data df = pd.DataFrame(pd.np.random.randint(0, 4, size=(5, 5)), index=[10, 50, 30, 2488, 9416], columns=[10, 50, 30, 2488, 9416]) # Quick and dirty method to make the example data symmetric df = df + df.T df 10 50 30 2488 9416 10 2 4 0 0 5 50 4 6 2 5 1 30 0 2 0 4 3 2488 0 5 4 4 0 9416 5 1 3 0 6 # To select the upper-triangular, non-diagonal entries, # take a *lower*-triangular mask, np.tril, # and negate it with ~. mask = (~np.tril(np.ones(df.shape)).astype('bool')) mask array([[False, True, True, True, True], [False, False, True, True, True], [False, False, False, True, True], [False, False, False, False, True], [False, False, False, False, False]]) # Prepare to select rows from the stacked df mask = mask.reshape(df.size) # Stack the columns of the starting matrix into a MultiIndex, # which results in a MultiIndexed Series; # select the upper-triangular off-diagonal rows; # reset the MultiIndex levels into columns df.stack()[mask].reset_index().rename({'level_0': 'UserID_row', 'level_1': 'UserID_col', 0: 'Occurrence'}, axis=1) UserID_row UserID_col Occurrence 0 10 50 4 1 10 30 0 2 10 2488 0 3 10 9416 5 4 50 30 2 5 50 2488 5 6 50 9416 1 7 30 2488 4 8 30 9416 3 9 2488 9416 0 ,您将需要在mLab数据库之前构建一个REST api,然后使用postman对其进行查询,您可以从中获得一些启发here < / p>

或者,如果您只想查看内部数据,请考虑使用MongoDB Compass

Connect like this