我对MongoDB还不熟悉&正在开发一个普通的应用程序。在mongo数据库中(我使用的是mongoose),集合是从第三方API 动态添加的,如schoolList1、schoolList2、schoolList3、schoolList4、.。
我面临的问题是如何找到从集合中获取数据的解决方案,就像用户从FrontEnd发送参数以从schoolList3查找数据一样。find函数应该只应用于该集合&返回数据。
我无法解决如何在没有传递模式的情况下获得数据,并且没有得到任何其他方法。
发布于 2018-11-08 12:15:33
根据用户的输入为模式设置集合名称选项:
var collectionName = 'schoolList3'; // set value from the input
var dataSchema = new Schema({/** your schema here **/}, { collection: collectionName });https://stackoverflow.com/questions/53207219
复制相似问题