nosql

Passing values to a map function - CouchDB

依然范特西╮ 提交于 2019-12-11 02:34:00
问题 I was wondering whether its possible to pass values to a map function in couchDB design document. For Example: In the code below is it possible to pass a value that has been entered by the user and use that value to run the map function. Maybe I can pass users UserName when they login and then display the view based on the map function. function(doc) { if(doc.name == data-Entered-By-User) { emit(doc.type, doc); } } Thank you in advance. Regards 回答1: This is a common mistake in CouchDB when

MongoDB Schema Design for Time Tracking

久未见 提交于 2019-12-11 02:28:01
问题 I have created a simple time tracking application in which people can TimeIn, TimeOut and mark breaks. The central object to this Tracking is an Event generated by User . This combined with UserStatus makes sure the state management is correct. Here are the schemas minus updatedAt createdAt fields: { userId: { type : mongoose.Schema.Types.ObjectId, required: true }, localTime: {type: Date}, userEmail: { type: String, required: true }, type: { type : String, required: true }, ip: { type :

MongoDB extremely slow comparing to MySQL with 10M records

为君一笑 提交于 2019-12-11 02:26:37
问题 I've got fairly high loaded project, running on MySQL with around 10M records, getting capped with approx 500 requests per second. The data is pretty unique, and cache hit rate is around 3% only. Every row got about 10 fields, 2 of which indexed. 99% of my queries use the two index fields for requests. I decided to try a NoSQL, and MongoDB was no brainer. Moving data was pretty easy, with simple custom made script. Database schema remained exactly the same, I replicated the same two indexes

How to get last message from chat conversation in mongodb

你。 提交于 2019-12-11 02:23:32
问题 I have tried to get last message in chat between users. Below is my collections in my document. { "toUser":123,"fromUser":456,"message":"1 from suresh","timeStamp":"2019-10-09 16:39:14:1414 PM +05:30", "toUser":456,"fromUser":123,"message":"Man super man ","timeStamp":"2019-10-09 16:43:09:0909 PM +05:30", "toUser":456,"fromUser":123,"message":"Kk","timeStamp":"2019-10-09 18:31:12:1212 PM +05:30" "toUser":456,"fromUser":123,"message":"It working man","timeStamp":"2019-10-09 18:31:18:1818 PM

MongoDB get error as an the target machine actively refused it [duplicate]

人盡茶涼 提交于 2019-12-11 02:15:32
问题 This question already has answers here : Mongodb: Failed to connect to 127.0.0.1:27017, reason: errno:10061 (17 answers) Closed 3 years ago . i'm newbie in mongodb and after installing mongo installer package on windows i get this error when i try to use mongo on shell and command prompt. i can not find any solution for this problem: C:\Program Files\MongoDB 2.6 Standard\bin>mongo MongoDB shell version: 2.6.7 connecting to: test 2015-02-20T16:43:11.971+0330 warning: Failed to connect to 127.0

How to query item's metadata from Couchbase?

廉价感情. 提交于 2019-12-11 01:49:14
问题 I put some data to CouchBase 1.8.1,and get it successful.But I want to query its metadata,as expiration and att_reason(non-json or json).In some document,it list the metadata with json format,for example: { "_id" : "contact_475", "_rev" : "1-AB9087AD0977F089", "_bin" : "...", "$flags" : 0, "$expiration" : 0, "name" : "Fred Bloggs", } How can I query item's metadata? 回答1: As Pavel the most common way to access metadata in Couchbase (2.0) is using Views. You can also use the internal TAP

Transferring CouchDB .couch files from Windows to Linux

半世苍凉 提交于 2019-12-11 01:46:34
问题 Am currently working on a CouchDB project, and have recently decided to switch to a Linux environment for development as I plan to deploy on a Linux server. I was hoping to copy over my .couch files straight from - Program Files/Apache Software Foundation/CouchDB-1-1-1/var/lib/couchdb - and paste them directly into what I guess should be - var/lib/couchdb - But I keep running into file/folder permission errors each time I try to access var/lib/couchdb . Is it even possible to transfer .couch

Multi Map / Reduce index vs. relational join

落爺英雄遲暮 提交于 2019-12-11 01:39:11
问题 One of the key factors making NoSQL databases more scalable is absense of join operation which is essential part of RDBMS. But at the same time, for example, RavenDb contains Multi Maps / Reduce index feature which looks similar to join. Why do joins limitate scalability but Multi Maps / Reduce indexes do not while they solve pretty similar tasks? 回答1: It depends on when you are actually perform the operation. Join operations are usually executed on the fly, which means that your incur the

How to import documents that have arrays with the Cosmos DB Data Migration Tool

心已入冬 提交于 2019-12-11 01:18:10
问题 I'm trying to import documents from a SQL Server database. Each document will have a list of products that a customer has bought, for example: { "name": "John Smith" "products": [ { "name": "Pencil Sharpener" "description": "Something, this and that." }, { "name": "Pencil case" "description": "A case for pencils." } ] } In the SQL Server database, the customer and products are stored in separate tables with a one-to-many relationship between the customer and products: Customer Id INT Name

Cassandra Data Model

旧时模样 提交于 2019-12-11 01:18:08
问题 I'm working on a POC to showcase how Cassandra works. I took Digg as an example. I wanted to create a data model that'll let me: 1) Add links 2) Add a link to a user favorite list. 3) Attached predetermined tags to links I came up with two Column Families: Links url is the key id (a generated uuid) user (who added it) favCount (no of users who favorited the link) upCount (no of users who liked it) downCount (no of users who disliked it) UserFavs user is the key id (as many ids as the user has