nosql

小谈Mongo_2_增删改查

流过昼夜 提交于 2019-12-21 20:28:09
增删改查 创建数据库 语法 MongoDB 创建数据库的语法格式如下: use DATABASE_NAME 如果数据库不存在,则创建数据库,否则切换到指定数据库。 实例 以下实例我们创建了数据库 mongo: use mongo db 如果你想查看所有数据库,可以使用 show dbs 命令: show dbs 可以看到,我们刚创建的数据库 mongo 并不在数据库的列表中, 要显示它,我们需要向 mongo 数据库插入一些数据。 db.mongo.insert({"name":"mongodb中文网"}) show dbs MongoDB 中默认的数据库为 test,如果你没有创建新的数据库,集合将存放在 test 数据库中。 删除数据库 语法 MongoDB 删除数据库的语法格式如下: db.dropDatabase() 删除当前数据库,默认为 test,你可以使用 db 命令查看当前数据库名。 实例 以下实例我们删除了数据库 mongo。 首先,查看所有数据库: show dbs 接下来我们切换到数据库 mongo use runoob 执行删除命令: db.dropDatabase() 最后,我们再通过 show dbs 命令数据库是否删除成功: show dbs 删除集合 db.collection.drop() 插入文档 MongoDB 使用 insert() 或

Cassandra data model for time series

北慕城南 提交于 2019-12-21 20:15:44
问题 I am working on a Cassandra data model for storing time series (I'm a Cassandra newbie). I have two applications: intraday stock data and sensor data. The stock data will be saved with a time resolution of one minute. Seven datafields build one timeframe: Symbol, Datetime, Open, High, Low, Close, Volume I will query the data mostly by Symbol and Date. e.g. give me all data for AAPL between 2013-01-01 and 2013-01-31 ordered by Datetime. The recommendation for cassandra queries is to query

MongoDB 查询文档

落爺英雄遲暮 提交于 2019-12-21 18:29:18
MongoDB 查询文档 语法 MongoDB 查询数据的语法格式如下: >db.COLLECTION_NAME.find() find() 方法以非结构化的方式来显示所有文档。 如果你需要以易读的方式来读取数据,可以使用 pretty() 方法,语法格式如下: >db.col.find().pretty() pretty() 方法以格式化的方式来显示所有文档。 实例 以下实例我们删除了数据库 runoob。 > db.col.find().pretty() { "_id" : ObjectId("56063f17ade2f21f36b03133"), "title" : "MongoDB 教程", "description" : "MongoDB 是一个 Nosql 数据库", "by" : "菜鸟教程", "url" : "http://www.runoob.com", "tags" : [ "mongodb", "database", "NoSQL" ], "likes" : 100 } 除了 find() 方法之外,还有一个 findOne() 方法,它只返回一个文档。 MongoDB 与 RDBMS Where 语句比较 如果你熟悉常规的 SQL 数据,通过下表可以更好的理解 MongoDB 的条件语句查询: 操作 格式 范例 RDBMS中的类似语句 等于 {<key>:

MongoDB versus CouchDB… And any other “major players”

浪尽此生 提交于 2019-12-21 17:56:31
问题 What are the major differences between MongoDB and CouchDB, and are there any other major NO-SQL database-servers out there worth mentioning? I know that CERN uses CouchDB somewhere in their LHC back-end; huge stamp of approval. What are MongoDB - and any other major servers' - references? Update One of the major selling points of CouchDB, to me, is the REST-based API and seamless JavaScript integration using JSON as a data-wrapper. Is this possible with any of the other NO-SQL databases

MongoDB versus CouchDB… And any other “major players”

白昼怎懂夜的黑 提交于 2019-12-21 17:56:10
问题 What are the major differences between MongoDB and CouchDB, and are there any other major NO-SQL database-servers out there worth mentioning? I know that CERN uses CouchDB somewhere in their LHC back-end; huge stamp of approval. What are MongoDB - and any other major servers' - references? Update One of the major selling points of CouchDB, to me, is the REST-based API and seamless JavaScript integration using JSON as a data-wrapper. Is this possible with any of the other NO-SQL databases

Redis的介绍与使用(一)

女生的网名这么多〃 提交于 2019-12-21 14:23:44
一、Redis简介 1.关于关系型数据库和nosql数据库   关系型数据库是基于关系表的数据库,最终会将数据持久化到磁盘上,而nosql数据 库是基于特殊的结构,并将数据存储到内存的数据库。从性能上而言,nosql数据库 要优于关系型数据库,从安全性上而言关系型数据库要优于nosql数据库,所以在实 际开发中一个项目中nosql和关系型数据库会一起使用,达到性能和安全性的双保证。 2.为什么要使用Redis   1、 redis简介     redis是Nosql 数据库 中使用较为广泛的非关系型内存数据库,redis内部是一个key-value存储系统。它支持存储的value类型相对更多,包括string(字符串)、list(链表)、set(集合)、zset(sorted set –有序集合)和hash(哈希类型,类似于 Java 中的map)。Redis基于内存运行并支持持久化的NoSQL数据库,是当前最热门的NoSql数据库之一,也被人们称为 数据结构 服务器。   2、 互联网时代背景下大机遇,什么要使用Nosql?     1) 当数据量的总大小一个机器放不下时。     2) 数据索引一个机器的内存放不下时。     3) 访问量(读写混合)一个实例放不下时。 单机时代模型    如果每次存储成千上万条数据,这样很会导致 MySQL 的性能很差,存储以及读取速度很慢

SQL vs NoSQL for data that will be presented to a user after multiple filters have been added

浪尽此生 提交于 2019-12-21 13:09:39
问题 I am about to embark on a project for work that is very outside my normal scope of duties. As a SQL DBA, my initial inclination was to approach the project using a SQL database but the more I learn about NoSQL, the more I believe that it might be the better option. I was hoping that I could use this question to describe the project at a high level to get some feedback on the pros and cons of using each option. The project is relatively straightforward. I have a set of objects that have

How to avoid data loss on server failure with MongoDB on a single machine?

Deadly 提交于 2019-12-21 13:09:30
问题 I have read that mongoDB don't write data to disk right away, it does this periodically. Any thoughts on how to deal with this? 回答1: You can enable journaling with --journal . Check out http://www.adathedev.co.uk/2011/03/mongodb-journaling-performance-single.html and http://www.mongodb.org/display/DOCS/Durability+and+Repair 回答2: Besides --journal that is enabled by default since MongoDB 2.0 ( only on 64 bit machines), there is a flag that you can set when persisting data: safe => false : do

How to quickly fetch all documents MongoDB pymongo

萝らか妹 提交于 2019-12-21 12:19:12
问题 Currently I fetch documents by iterating through cursor in pymongo, for example: for d in db.docs.find(): mylist.append(d) For reference, performing a fetchall on the same set of data (7m records) takes around 20 seconds while the method above takes a few minutes. Is there a faster way read bulk data in mongo? Sorry I'm new to mongo, please let me know if more information is needed. 回答1: using the $natural sort will bypass the index and return the documents in the order in which they are

CouchDB Views: How much processing is acceptable in map reduce?

痴心易碎 提交于 2019-12-21 09:37:04
问题 I've been toying around with Map Reduce with CouchDB. Some of the examples show some possibly heavy logic within the map reduce functions. In one particular case, they were performing for loops within map. Is map reduce run on every single possible document before it emits your selected documents? If so, I would think that means that running any kind of iterative processing within the map reduce functions would increase processing burden by an order of magnitude, at least. Basically it boils