nosql

Structuring Firebase data

空扰寡人 提交于 2019-12-11 09:12:19
问题 I have some difficulties with structuring the data for Firebase. I have uses and rooms. Each user can join multiple rooms and each room can have multiple users. This is my setup right now: I save all the room id's at the linked device (room_info). All linked devices are under the key -> device_info at the room child. I save the device name there for fast lookup. I have used this webbpage to validate my idea: https://www.firebase.com/docs/web/guide/structuring-data.html Is there something that

If everything's denormalized, doesn't that make updates really slow (Author, blog example inside)

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-11 08:58:09
问题 So I'm switching to NoSQL from SQL background. So I know I should be 'denormalizing' here.. So basically I have a simplified idea of what i have to do; Users These documents hold authentication info, maybe payment method, username and all kinds of details Posts These posts are made by users, and in each post, we have to display the username and email of a user. So by method of 'denormalizing', I would put the username and the email of the user into each post s/he makes. But doesn't this

Adding Secondary index on Cassandra indexes historical data?

坚强是说给别人听的谎言 提交于 2019-12-11 08:48:46
问题 if on a particular column family i add a index on a column later on will it index the historical data too or data which comes now after adding the index. Here in this When does Cassandra DB index data after updating a column as secondary index The accepted answer says it will index only data which is inserted after creating the index. I tried creating a CF with index on a column.(i am using Cassandra 1.0.7) create column family users with comparator=UTF8Type and column_metadata=[{column_name:

Store documents (.pdf, .doc and .txt files) in MaprDB

会有一股神秘感。 提交于 2019-12-11 08:25:11
问题 I need to store documents such as .pdf, .doc and .txt files to MaprDB. I saw one example in Hbase where it stores files in binary and is retrieved as files in Hue, but I not sure how it could be implemented. Any idea how can a document be stored in MaprDB? 回答1: First thing is , Im not aware about Maprdb as Im using Cloudera. But I have experience in hbase storing many types of objects in hbase as byte array like below mentioned. Most primitive way of storing in hbase or any other db is byte

How to find documents, which field is a substring to the specific string?

送分小仙女□ 提交于 2019-12-11 07:46:25
问题 Is there any way to find a document in MongoDB collection, which field is a substring to my "string" ? Just a little example. Suppose I have this collection: {"str": "pho", ...}, {"str": "sma", ...}, {"str": "goa", ...}, {"str": "aba", ...}, {"str": "gag", ...} ... And my "string" is "smartphone" for example. So the result of the query should be: {"str": "pho", ...} {"str": "sma", ...} For now I use this regex to solve my problem: ^[smartphone]+$ That works, but it'll also match documents

read data from cassandra using java

≡放荡痞女 提交于 2019-12-11 07:28:28
问题 My sample cassandra table looks like id | article_read | last_hours | name ----+----------------------------------- 5 | [4, 5, 6] | 5 | shashank 10 | [12, 88, 32] | 1 | sam 8 | [4, 5, 6] | 8 | aman 7 | [5, 6] | 7 | ashif 6 | [4, 5, 6] | 6 | amit 9 | [4, 5, 6] | 9 | shekhar My java code to read data from Cassandra table using cql queries, Scanner sc = new Scanner(System.in); System.out.println("enter name1 "); String name1 = sc.nextLine(); System.out.println("enter name2"); String name2 = sc

What is 'document data store' and 'key-value data store'?

家住魔仙堡 提交于 2019-12-11 07:14:44
问题 What is document data store ? What is key-value data store ? Please, describe in very simple and general words the mechanisms which stand behind each of them. 回答1: In a document data store each record has multiple fields, similar to a relational database. It also has secondary indexes. Example record: "id" => 12345, "name" => "Fred", "age" => 20, "email" => "fred@example.com" Then you could query by id, name, age, or email. A key/value store is more like a big hash table than a traditional

How do i create relationships for existing nodes by importing csv file in neo4j?

﹥>﹥吖頭↗ 提交于 2019-12-11 07:09:22
问题 lets say i have created [a],[b],[c],[d] nodes in neo4j. how to create relationships among those nodes by importing csv data. csv data: id,fromNode,toNode,typeOfRelation 1,a,b,KNOWs 2,b,c,FOLLOWS 3,d,a,KNOWS .... 回答1: I would do it like this way if your Nodes are in the Graph already. CREATE INDEX ON :Label(name); LOAD CSV WITH HEADERS FROM "file:///<PathToYourCSV>" as input MATCH (from:Label {name: input.fromNode}), (to:Label {name: input.toNode}) CREATE (from)-[:RELATION { type: input

Dealing with dynamic Query String in Cassandra

大憨熊 提交于 2019-12-11 07:07:30
问题 I have employee table which has following column as id, firstName, lastName, email, age. From UI, I have filter option which is coming as a query string. Let's say user want to filter data based on firstName and age, so query string will be ?firstName='John'&age>21 . I know in Cassandra, we need to create multiple tables based on criteria or use materialized view to filter the query. Question: How we will identify which table/MV(repository) it has to call based on query string coming from UI?

How to search in a Collection with unknown structure?

十年热恋 提交于 2019-12-11 06:58:52
问题 I spent several hours reading through docs and forums, trying to find a solution for the following problem: In A Mongo database, I have a collection with some unstructured data: {"data" : "some data" , "_id" : "497ce96f395f2f052a494fd4"} {"more_data" : "more data here" ,"recursive_data": {"some_data": "even more data here", "_id" : "497ce96f395f2f052a4323"} {"more_unknown_data" : "string or even dictionaries" , "_id" : "497ce96f395f2f052a494fsd2"} ... The catch is that the elements in this