nosql

MongoDB Compound Indexes - Does the sort order matter?

江枫思渺然 提交于 2019-12-12 09:27:32
问题 I've dived recently into mongodb for a project of mine. I've been reading up on indexes, and for a small collection, i know it wouldn't matter much but when it grows there's going to be performance issues without the right indexes and queries. Lets say i have a collection like so {user_id:1,slug:'one-slug'} {user_id:1,slug:'another-slug'} {user_id:2,slug:'one-slug'} {user_id:3,slug:'just-a-slug} And i have to search my collection where user id == 1 and slug == 'one-slug' In this collection,

Event logging with distributed database for node.js (MongoDB?)

爱⌒轻易说出口 提交于 2019-12-12 09:02:24
问题 I am looking for system or library for node.js, that can log information about client access on every remote server and automatically gather that information on central log server for later analysis. Remote server will have write only access, while central server will accumulate a lot of data to read. I hope there is solution using distributed [NoSQL] database, like MongoDB. However I have not found how to set it up. For example I hope that cleaning old data can be initiated on central log

Is creating multiple PouchDB databases on the same application considered bad design?

99封情书 提交于 2019-12-12 08:24:07
问题 I come from a Mysql background and I'm using Pouchdb now. I'm used to the SQL pattern of having 1 database and many tables per app. In pouchDB it's different, because data is not stored in tables but in documents. So, in my app, I have a database for tasks, created with: var db = new PouchDB('tasks', {revs_limit: 1, auto_compaction: true}); This is the main database for my application, but now I need to also store settings, such as "last_visit_date", "language_preference" and others. So, I

count total number of elements inside an array in document - MongoDB

折月煮酒 提交于 2019-12-12 08:15:33
问题 I have a document related to the role or designations of employees. This is the document structure. { "_id" : ObjectId("5660c2a5b6fcba2d47baa2d9"), "role_id" : 4, "role_title" : "Carpenter", "employees" : [ { "$ref" : "employees", "$id" : 4, "$db" : "db_cw2" }, { "$ref" : "employees", "$id" : 5, "$db" : "db_cw2" } ] }, { "_id" : ObjectId("5660c2a5b6fcba2d47baa2d6"), "role_id" : 1, "role_title" : "Chief Executive", "employees" : [ { "$ref" : "employees", "$id" : 1, "$db" : "db_cw2" } ] } I

Why does MongoDB perform better with multi-threaded client compared to a single threaded client?

萝らか妹 提交于 2019-12-12 08:06:58
问题 We recently benchmarked Oracle 10g and MongoDB with YCSB ( https://github.com/brianfrankcooper/YCSB/wiki ), when we tried to increase the number of threads for 1,000,000 datasets, Oracle's performance remained constant after 4 threads however MongoDB kept on performing better and better till 8 threads and after that only reads were better, writes and updates (operations/sec) remained constant. We ran this benchmark on 2 CPU Xeon quad core (total 8 cores) + 8 GB RAM on LAN. What we observed

neo4j: one-directional / two-directional relationships?

六月ゝ 毕业季﹏ 提交于 2019-12-12 07:45:45
问题 So I looked into neo4j, and I may be using it in an upcoming project since its data model might fit my project very well. I looked through the docs but I still need an answer to this question: Can I set relationships to be one-directional? It seems that the neo4j people like movies so let's continue with that. If I have a graph like this: Actor A -> [:Acts in] -> Movie B then direction is obvious, because the nodes are different types. But I like horror movies so... Person A -> [:wants_to

Query mongodb to return documents created today

烂漫一生 提交于 2019-12-12 07:39:59
问题 how can I write filter which results docs created today.I know ObjectId has timestamp. I tried this : db.doc.find({_id : { $gte : ObjectId().getTimestamp().getTime() }} Can I write db.doc.find({'_id.getTimestamp().getTime()' : { $gte : ObjectId().getTimestamp().getTime() }} 回答1: Try the following (based on this answer). This returns all documents created since the given date. So it covers todays entries as well. db.doc.find({_id : { $gt : ObjectId(Math.floor(new Date('2014/01/30')/1000)

Saving, organizing and querying products, options/tags and categories

隐身守侯 提交于 2019-12-12 07:38:21
问题 First of all, let me make clear that I'm not asking for any code; I just wan't some general ideas/guidance/opinions about how could I implement what I'm about to ask. I'm starting to build an online e-commerce system (Yii2 + MongoDB, so, PHP + NoSQL), and there are two requisites that I'm not entirely sure how to implement without creating a huge mess in both my code and the database. Both requisites are related, so I'll explain them both as one. As any other serious e-commerce, it would have

“Could not find transactional storage type” error with embedded RavenDB

吃可爱长大的小学妹 提交于 2019-12-12 07:26:05
问题 I was able to successfully run a simple test for RavenDB based on the code found at: http://ravendb.net/tutorials/hello-world Next I tried to run it in an Embedded Manner, but I keep on getting the following error: Message: Could not find transactional storage type: Raven.Storage.Esent.TransactionalStorage, Raven.Storage.Esent StackTrace: at Raven.Database.Config.InMemoryRavenConfiguration.CreateTransactionalStorage(Action notifyAboutWork) in c:\Builds\raven\Raven.Database\Config

Good reasons NOT to use a relational database?

和自甴很熟 提交于 2019-12-12 07:09:01
问题 Can you please point to alternative data storage tools and give good reasons to use them instead of good-old relational databases? In my opinion, most applications rarely use the full power of SQL--it would be interesting to see how to build an SQL-free application. 回答1: Plain text files in a filesystem Very simple to create and edit Easy for users to manipulate with simple tools (i.e. text editors, grep etc) Efficient storage of binary documents XML or JSON files on disk As above, but with a