nosql

How to get nodes that have a given amount of outgoing relationships with a given property in Neo4j Cypher?

末鹿安然 提交于 2019-12-06 00:51:50
In my domain a node can have several relationships of the same type to other entities. Each relationship have several properties and I'd like to retrieve the nodes that are connected by at least 2 relationships that present a given property. EG: A relationship between nodes have a property year . How do I find the nodes that have at least two outgoing relationships with the year set to 2012 ? Why Chypher query so far looks like this (syntax error) START x = node(*) MATCH x-[r:RELATIONSHIP_TYPE]->y WITH COUNT(r.year == 2012) AS years WHERE HAS(r.year) AND years > 1 RETURN x; I tried also

NoSql概述

北城余情 提交于 2019-12-06 00:02:31
1.什么是NoSql   是一项全新的数据库理念,泛指非关系型的数据库 2.为什么需要NoSql   1.对数据库高并发读写的需求   2.对海量数据的高效率存储和访问的需求   3.对数据库的高可扩展性和高可用性的需求   NoSql数据库的产生就是为了解决大规模数据集合多重数据种类带来的挑战,尤其是大数据应用难题 3.主流NoSql产品   redis、mongoDB   NoSql分类:     a.键值(Key-Value)存储数据库:redis   典型应用:内容缓存,主要用于处理大量数据的高访问负载  优势:快速查询  劣势:存储的数据结构缺少结构化     b.列存储数据库:HBase  典型应用:分布式的文件系统  优势:查找速度快,可扩展性强,更容易进行分布式扩展  劣势:功能相对局限     c.文档类型数据库:MongoDB  典型应用:web应用(与Key-Value类似,Value是结构化的)  优势:数据结构要求不严格  劣势:查询性能不高 来源: https://www.cnblogs.com/Life-is-Demo/p/11951858.html

简单概括下MongoDB 4.0 新特性

别等时光非礼了梦想. 提交于 2019-12-05 23:58:42
4.0 版本 (1)跨文档事务支持 (ACID) 首个支持跨文档事务的NoSQL云数据库,将文档模型的速度,灵活性和功能与ACID保证相结合。现在,使用MongoDB解决各种用例变得更加容易。 (4.0 的事务存在最大修改 16MB、事务执行时间不能过长的限制) (2)40%迁移速度提升 并发的读取和写入,使得新增分片shard迁移性能提升了约 40%, 新增节点能更快的承载业务压力。 (3)读性能大幅扩展 4.0版本借助事务特性,使得备节点不再因为同步日志而阻塞读取请求。 (4)Change Stream 增强 在MongoDB3.6之前,如果我们希望对MongoDB数据库中的数据变动进行监听,通常是通过 “监听并回放oplog”。从MongoDB3.6开始支持的 Change Streams打破了这个僵局。 Change Streams使得数据的变动监听变得简单易用。如果你只需要针对某一个collection进行变动监听,MongoDB3.6就可以满足你的需求。在4.0版本中我们可以针对若干个数据库或者整个实例(复制集或者sharding)进行变动监听。与 watch() 某一个collection不同,4.0中我们可以 watch() 某个数据库或者整个实例。 4.2 版本 (1)分布式事务 4.2 支持分布式事务,MongoDB 采用二阶段提交的方式,实现在多个 Shard

图文并茂带你了解分布式架构的演进

不问归期 提交于 2019-12-05 23:28:30
系统架构演化历程-初始阶段架构 初始阶段 的小型系统 应用程序、数据库、文件等所有的资源都在一台服务器上通俗称为LAMP 特征: 应用程序、数据库、文件等所有的资源都在一台服务器上。 描述: 通常服务器操作系统使用linux,应用程序使用PHP开发,然后部署在Apache上,数据库使用Mysql,汇集各种免费开源软件以及一台廉价服务器就可以开始系统的发展之路了。 系统架构演化历程-应用服务和数据服务分离 好景不长,发现随着系统访问量的再度增加,webserver机器的压力在高峰期会上升到比较高,这个时候开始考虑增加一台webserver 特征: 应用程序、数据库、文件分别部署在独立的资源上。 描述: 数据量增加,单台服务器性能及存储空间不足,需要将应用和数据分离,并发处理能力和数据存储空间得到了很大改善。 系统架构演化历程-使用缓存改善性能 特征: 数据库中访问较集中的一小部分数据存储在缓存服务器中,减少数据库的访问次数,降低数据库的访问压力。 描述: 系统访问特点遵循二八定律,即80%的业务访问集中在20%的数据上。 缓存分为本地缓存和远程分布式缓存,本地缓存访问速度更快但缓存数据量有限,同时存在与应用程序争用内存的情况。 系统架构演化历程-使用应用服务器集群 在做完分库分表这些工作后,数据库上的压力已经降到比较低了,又开始过着每天看着访问量暴增的幸福生活了,突然有一天

CouchDB Group Level and Key Range

倾然丶 夕夏残阳落幕 提交于 2019-12-05 22:59:33
问题 Can anyone explain to me why the following doesn't work: Assuming the following document structure: { "_id": "520fb089a6cb538b1843cdf3cca39a15", "_rev": "2-f96c27d19bf6cb10268d6d1c34799931", "type": "nosql", "location": "AZ", "date": "2012/03/01 00:00:00", "amount": 1500 } And a Map function defined like so: function(doc) { var saleDate = new Date(doc.date); emit([doc.location,saleDate.getFullYear(),saleDate.getMonth()+1],doc.amount); } And using the built in _sum function for the reducer.

How to call to mongodb inside my map/reduce functions? Is it a good practice?

☆樱花仙子☆ 提交于 2019-12-05 22:30:23
I would like to know if: Firstly: Is it possible to use mongodb functions inside my map/reduce functions, for example: function() { foo = db.myCollection.find({ _id: ObjectId('4ee235ce002c62f393000008')}) print(foo); # returns 'db.myCollection -> undefined' } Secondly: Is it a good practice? For example, I need to map a specific property from the documents referenced for a 'root' document. Or maybe, can I set a habtm relationship on this specific property? Thanks! although it is possible to call methods from the db object from MR, it is not recommended since it does not work properly with

Use NoSQL in MySQL

佐手、 提交于 2019-12-05 22:02:38
I've noticed MySQL could use Memcached NoSQL with InnoDB but I can't retrieve information about how to use it. I want to use with PHP. Are NoSQL queries standard? First of all, MySQL only support memcached with NoSQL since version 5.6. Today this version it's not update yet in linux repositories and must be manually installed, specially in servers, e.g. MySQL --version (ubuntu) is 5.5.38 ; (RedHat server) 5.1 You also must install libevent-dev e.g: Still some hacks are needed, and you must install memcache interface plugin for MySQL located in $MYSQL_HOME/share . I found a well explained post

Is there a reason that Cassandra doesn't have Geospatial support?

一曲冷凌霜 提交于 2019-12-05 21:57:12
问题 Since Cassandra is based off of the Dynamo paper (distributed, self-balancing hash table) + BigTable and there are spatial indexes that would fit nicely into that paradigm (quadkey or geohash). Is there a reason that Geospatial support hasn't been implemented? You could add a GeoPoint datatype as a tuple with an internal geohash and specify a CF as containing geo data. From there you can choose the behavior as having the geo data being a secondary index, or a denormalized SCF. That could lay

How to synchronize changes in nosql db (ravendb)

别说谁变了你拦得住时间么 提交于 2019-12-05 21:40:16
I've started learning NoSQL on an example of RavenDB. I've started with a simplest model, let's say we have topics that were created by users: public class Topic { public string Id { get; protected set; } public string Title { get; set; } public string Text { get; set; } public DenormalizedUser User { get; set; } } public class DenormalizedUser { public string Id { get; set; } public string Name { get; set; } } public class User { public string Id { get; protected set; } public string Name { get; set; } public DateTime Birthdate { get; set; } //some other fields } We don't need the whole User

“Within X miles” search in mongodb

假如想象 提交于 2019-12-05 20:25:57
I want to be able to find zip codes are that within a specific radius of distance from another zip code. I have some code from this source . But it is an SQL implementation using ActiveRecord. It is precisely the implementation I want but only with MongoDB. Help! Take a look at the MongoDB documentation and the Mongoid indexing docs . class Zip include Mongoid::Document field :code field :location, :type => Array # make sure to rake db:mongoid:create_indexes index [[ :location, Mongo::GEO2D ]], :min => 200, :max => 200 end # at the console Zip.create(:code => 1001, :location => [0, 0]) Zip