nosql

Jedis Changing the semantics of Redis?

 ̄綄美尐妖づ 提交于 2019-12-23 19:02:15
问题 So, Redis specify the zrange (and related sorted set commands) as an ORDERED set of results (a list without duplicates perhaps?). Why then the zrange (and related APIs) on Jedis (Official and Recommended REDIS client) return a Set??? Which has, by definition, no concept of ordering? That is a direct violation of the semantics of the redis operations. This is the zrange jedis 2.0.0 implementation: public Set<byte[]> zrange(final byte[] key, final int start, final int end) { checkIsInMulti();

Cassandra: cannot restrict 2 columns using clustering key(version 2.1.9)

拥有回忆 提交于 2019-12-23 17:50:22
问题 I have a schema pretty similar to this:- create table x(id int, start_date timestamp, end_date timestamp, primary key((id), start_date, end_date)) with clustering order by (start_date desc, end_date desc); Now I am stuck with a problem where I have to query between start date and end date. something like this : - select count(*) from x where id=2 and start_date > 'date' and end_date < 'date' ; But it gives me an error similar to the following: - InvalidRequest: code=2200 [Invalid query]

MongoDB: groupby subdocument and count + add total count

痞子三分冷 提交于 2019-12-23 17:42:02
问题 What I want to achieve Suppose having the following subdocument: { "id":1, "url":"mysite.com", "views": [ {"ip":"1.1.1.1","date":"01-01-2015"}, {"ip":"2.2.2.2","date":"01-01-2015"}, {"ip":"1.1.1.1","date":"01-01-2015"}, {"ip":"1.1.1.1","date":"01-01-2015"} ] } I want to count: how many IPs there are based on the "ip" value and also count the total of subdocuments in "views" if possible in the same query , to achieve the following result: [ { "_id":"2.2.2.2", "count":1 }, { "_id":"1.1.1.1",

Resolve Pouch Couch DB

回眸只為那壹抹淺笑 提交于 2019-12-23 16:18:32
问题 I am developing a prototype website that works offline that utilises Pouch DB so that it syncs back up to a CouchDB on a server when it goes online. The Pouch DB conflicts guide says: To resolve the conflict, you simpy put() a new revision on top of the current winner. How do you do this? I have the tried the following functions but neither work as expected: function (current, chosen) { chosen._rev = current._rev; chosen._conflicts = []; db.put(chosen); }; function (chosen) {; db.put(chosen);

Low TTL with Leveled Compaction, should I reduce gc_grace_seconds to improve read performance without impacting delete replication?

末鹿安然 提交于 2019-12-23 16:02:18
问题 Low TTL with Leveled Compaction, should I reduce gc_grace_seconds to improve read performance? Scenario: Cassandra Table to cache an external db values - read performance needs to be good (less than 100ms) TTL = 4 hrs at row level Functional full table refresh (delete and then lazy load) every 6 hrs If I keep gc_grace_seconds at default value of 10 days , I can potentially have 60 rows with tombstones for every live row. This will affect read performance. Or not? Is reducing gc_grace_seconds

How to get all documents from the data bucket using c#?

蓝咒 提交于 2019-12-23 15:52:42
问题 How can I get all the documents from the data bucket? I have tried a sample but I'm able to get only a specific document. Here is my code: CouchbaseClient oclient; oclient= new CouchbaseClient("vwspace", "");// data bucket name var results = oclient.Get("205");// document id How to get all the documents? var results = oclient.? //what should i use here to get all documents 回答1: Using Couchbase Server 2.0, you would use a view to get all documents. Your view would look like: function (doc,

Does using non-SQL databases obviate the need for guarding against “SQL injection”?

怎甘沉沦 提交于 2019-12-23 14:56:51
问题 This may seem like an obvious (or not so obvious) question, but let me explain. I'm coding up a Google App Engine site using Google's database technology, BigTable. Any App Engine coders will know that Google has its own limited query language called GQL. As a result, I am tempted not to do any checking for SQL (or GQL) injection in my app since I assume Google is not using a raw string query on its backend methods to fetch data. Furthermore, libraries for DB technologies like CouchDB,

Count number of records in a column family in an HBase table

喜你入骨 提交于 2019-12-23 14:02:13
问题 I'm looking for an HBase shell command that will count the number of records in a specified column family. I know I can run: echo "scan 'table_name'" | hbase shell | grep column_family_name | wc -l however this will run much slower than the standard counting command: count 'table_name' , CACHE => 50000 (because the use of the CACHE=>50000) and worse - it doesn't return the real number of records, but something like the total number of cells (if I'm not mistaken?) in the specified column

Count number of records in a column family in an HBase table

蓝咒 提交于 2019-12-23 14:02:01
问题 I'm looking for an HBase shell command that will count the number of records in a specified column family. I know I can run: echo "scan 'table_name'" | hbase shell | grep column_family_name | wc -l however this will run much slower than the standard counting command: count 'table_name' , CACHE => 50000 (because the use of the CACHE=>50000) and worse - it doesn't return the real number of records, but something like the total number of cells (if I'm not mistaken?) in the specified column

Spring data mongodb query for subdocument field

南楼画角 提交于 2019-12-23 10:55:15
问题 I'm using Spring Data's CrudRepository with mongodb and i have some issue to write a query which will select a document with specific subdocument value. Here's an example: { "_id" :, "_class" :, "matchHeader" : { "suspend" : {}, "active" : true, "booked" : true, "eventId" : NumberLong(1009314492), "status" : "" }, "matchInfo" : { } } } i need to select the document with specific eventId field in matchHeader subdocument. i tried to write a function like this findByMatchHeaderEventId(id) but it