无论如何,在 Deno 中是否可以使用模式?

发布于 2025-01-14 08:13:41 字数 1088 浏览 2 评论 0原文

我正在尝试使用 Deno 和 MongoDB 存储和使用类似于以下结构的数据。

   [
      {
        id: "AAPL",
        stockData: [
          { date: 1634601600, summary: [Object] },
          { date: 1634688000, summary: [Object] },
          { date: 1634774400, summary: [Object] },
          { date: 1634860800, summary: [Object] }
        ]
      },
      {
        id: "MSFT",
        stockData: [
          { date: 1634601600, summary: [Object] },
          { date: 1634688000, summary: [Object] }
        ]
      }
  ]

[Object] 类似于:

  {
    date: "1646956800",
    summary: { open: 287.96, high: 289.51, low: 279.43, close: 280.07, volume: 27209330 }
  }

由于 Deno 是新的,而且我知道目前与 Deno 和 Mongoose 不兼容,我有一些问题:

  1. Deno 是否有替代 Mongoose 的替代方案或更好的方案使用模式的方法?
  2. 如果我想做一个大项目,我现在应该停止使用 Deno 并返回使用 NodeJS 吗?
  3. 我可以将 Deno 代码转换为 NodeJS-TypeScript 代码吗?或者最好用 JavaScript 重写它?

我是一名平庸的程序员,也是网络开发领域的新手。我正在尝试编写我的第一个真实/商业项目,我不想因为缺乏 Deno 能力而陷入困境,也想使用最新的技术,并且不想在我之后用新技术重写项目完成了它。所以我不知道我应该保留我的项目使用 Deno 还是将其重写为 NodeJS 并忘记 Deno?

I am trying to store and work with a similar to following structure data using Deno and MongoDB.

   [
      {
        id: "AAPL",
        stockData: [
          { date: 1634601600, summary: [Object] },
          { date: 1634688000, summary: [Object] },
          { date: 1634774400, summary: [Object] },
          { date: 1634860800, summary: [Object] }
        ]
      },
      {
        id: "MSFT",
        stockData: [
          { date: 1634601600, summary: [Object] },
          { date: 1634688000, summary: [Object] }
        ]
      }
  ]

And [Object] is something like:

  {
    date: "1646956800",
    summary: { open: 287.96, high: 289.51, low: 279.43, close: 280.07, volume: 27209330 }
  }

As Deno is new and I know there is no compatibility with Deno and Mongoose at the moment, I have some questions:

  1. Is there any alternative to Mongoose for Deno or any better way to work with schemas?
  2. If I want to do a big project should I stop working with Deno and return to using NodeJS at the moment?
  3. Can I convert my Deno code to NodeJS-TypeScript code or it is better to rewrite it in JavaScript?

I am a mediocre programmer and new in web development. I am trying to write my first real/commercial project and I don't want to get stuck because of lack of abilities in Deno, also want to use the latest technology and don't want to rewrite the project with a new technology after I completed it. So I don't know should I keep my project using Deno or rewrite it to NodeJS and forget the Deno?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

你是我的挚爱i 2025-01-21 08:13:41

您可以使用 Deno 的 mongoDriver:https://deno.land/x/mongo
它不是 deno.land/x 上唯一可用的,您可以从 deno.land 网站进行搜索。

You can use the mongoDriver for Deno : https://deno.land/x/mongo.
It is not the only one available on deno.land/x, you can make a search from deno.land website.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文