简体   繁体   English

如何在Meanjs中从新的mongodb Collection创建架构并显示记录

[英]How to create schema and display record from new mongodb Collection in Meanjs

i am developing an application on MEAN STACK. 我正在开发MEAN STACK上的应用程序。 I want to show the data from an existing Collection in mongodb . 我想显示mongodb中现有集合的数据。 But i am not getting the clear idea how to attach this Collection with mean stack.I have seen Article example and sign up process but little bit confuse. 但是我不清楚如何将这个Collection与平均堆栈附加在一起。我已经看到了Article示例和注册过程,但有点困惑。

How to set up new Collection with meanjs. 如何使用meanjs设置新集合。

The most used tool for this is Mongoose . 最常用的工具是Mongoose A mongoose model should be created on server side and in the server controllers you expose the required operations (Create, Read, Update, Delete etc). 应该在服务器端创建猫鼬模型,并在服务器控制器中公开所需的操作(创建,读取,更新,删除等)。 MEAN uses Mongoose. MEAN使用猫鼬。

On client side you create services which will access the server side controllers. 在客户端,您将创建将访问服务器端控制器的服务。 The client side objects should have the same attributes as the server side model by convention. 按照惯例,客户端对象应具有与服务器端模型相同的属性。

I didn't use the MEAN Article example, but I used the Yeoman code generators to kick off some entities. 我没有使用MEAN Article示例,而是使用Yeoman代码生成器启动了一些实体。 I assume that the Article example follows the same pattern, so for server side model please check app/models, for the server side controllers check app/controllers, for client side services check public/modules/article/services. 我假设Article示例遵循相同的模式,因此对于服务器端模型,请检查app / models,对于服务器端控制器,请检查app / controller,对于客户端服务,请检查public / modules / article / services。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM