小编Hus*_*ali的帖子

Cassandra DB 将数据插入多个表

我一直在阅读有关 datastax 的 Cassandra Db 文档以及 Apache 文档。到目前为止,我了解到我们不能在一张表上创建多个索引(一个主索引,一个辅助索引)。每个查询都应该有一个单独的表。将此与 SQL 表进行比较,例如我们要查询 4 ​​个字段的 SQL 表,对于 Cassandra 的该表,我们应该将该表拆分为 4 个表,对吧?(如果我错了,请纠正我)。在这 4 个表上我可以拥有索引并进行查询,我的问题是我们如何将数据插入到这 4 个表中,我应该发出 4 个连续的插入请求吗?

我的首要任务是避免二级索引

database cassandra datastax-enterprise cassandra-2.0 cassandra-3.0

2
推荐指数
1
解决办法
716
查看次数

存储 GeoJson 点并在给定距离/半径内查找点 | NODEJS、Postgres、NestJs、TypeOrm

先感谢您。我在互联网上搜索了一个工作示例/文档,以获取存储位置点(经度、纬度)、查找两点之间的距离、查找给定距离内的点的方法。我正在使用 typeorm、nestjs、postgresql。

(我已经尝试过 Mariadb,但 St_distance_sphere 在那里不起作用,所以我要使用 postgresql)

这是我的实体

@ApiProperty({
    type: String,
    title: 'current_location',
    example: '{"type":"Point","coordinates":[28.612849, 77.229883]}',
  })
  @Index({ spatial: true })
  @Column({
    type: 'geometry',
    srid: 4326,
    nullable: true,
    spatialFeatureType: 'Point',
    transformer: {
      to: (v: Point) => {
        console.log(JSON.stringify(v));
        return eval(`ST_GeomFromGeoJSON(${JSON.stringify(v)})`);
      },
      from: (v: any) => {
        return { type: 'Point', coordinates: [v.x, v.y] } as Point;
      },
    },
  })
  current_location: string;
Run Code Online (Sandbox Code Playgroud)

似乎有太多的 postgres/postgis 文档,但对我的情况没有任何用处。任何帮助深表感谢。我已经坚持了一个多星期。

*注意:我不想使用 JSONB 数据类型,因为它的速度较慢。

postgresql geojson node.js typeorm nestjs

1
推荐指数
1
解决办法
673
查看次数