nosql

MongoDB equivalent of SQL “OR”

99封情书 提交于 2019-12-09 13:44:14
问题 So, MongoDB defaults to "AND" when finding records. For example: db.users.find({age: {'$gte': 30}, {'$lte': 40}}); The above query finds users >= 30 AND <= 40 years old. How would I find users <= 30 OR >= 40 years old? 回答1: There will be an or operator in the near future. The nightly Mongodb build has already an $or. You can also use $where and use JavaScript to express the or. See http://groups.google.com/group/mongodb-user/browse_thread/thread/a9a4d8b863d84601 回答2: There is no OR operator,

NoSQL: How to retrieve a 'house' based on lat & long?

时间秒杀一切 提交于 2019-12-09 13:26:46
问题 I have a NoSQL system for storing real estate houses. One piece of information I have in my key-value store for each house is the longitude and latitude . If I wanted to retrieve all houses within a geo-lat/long box, like the SQL below: SELECT * from houses WHERE latitude IS BETWEEN xxx AND yyy AND longitude IS BETWEEN www AND zzz Question: How would I do this type of retrieval with NoSQL ... using just a key-value store system? Even if I could do this with NoSQL, would it even be efficient

orientdb: passing an Array to a query using 'IN' on an OType.LINKLIST field

瘦欲@ 提交于 2019-12-09 12:58:08
问题 I'm trying to pass an array of Category POJOs to the query using IN in the SQL: public ShareObject[] search(String name, Category[] categories) { ... OSQLSynchQuery<ODocument> query = new OSQLSynchQuery<ODocument>("SELECT FROM ShareObject WHERE name LIKE ? AND categories IN ?"); List<ODocument> result = db.command(query).execute(name, categories); This will return an empty list. If I change the SQL to the following I get a result: "SELECT FROM ShareObject WHERE name LIKE ? AND categories IN [

Mongodb aggregation by day based on unix timestamp

南笙酒味 提交于 2019-12-09 12:39:25
问题 I have googled alot, but not found any helpful solution... I want to find total number of daily users. I have a collection named session_log having documents like following { "_id" : ObjectId("52c690955d3cdd831504ce30"), "SORTID" : NumberLong(1388744853), "PLAYERID" : 3, "LASTLOGIN" : NumberLong(1388744461), "ISLOGIN" : 1, "LOGOUT" : NumberLong(1388744853) } I want to aggregate from LASTLOGIN... This is my query: db.session_log.aggregate( { $group : { _id: { LASTLOGIN : "$LASTLOGIN" }, count:

Mongodb aggregate three collections

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-09 12:31:29
问题 Learning MongoDB for the past two days and I am trying to aggregate three collections but unable to achieve it Below are the four collection maintaining in the database university { "_id" : "5834ecf7432d92675bde9d82", "name": "NIFT" } college { "_id" : "5834ecf7432d92675bde9d83", "name": "NIFT Hyderabad", "university_id":"5834ecf7432d92675bde9d82" } departments { "_id" : "5834ecf7432d92675bde9d84", "department_name": "Fashion Technology", "college_id" : "5834ecf7432d92675bde9d83" }, { "_id" :

Namespaces in Redis?

半城伤御伤魂 提交于 2019-12-09 07:23:24
问题 Is it possible to create namespaces in Redis? From what I found, all the global commands (count, delete all) work on all the objects. Is there a way to create sub-spaces such that these commands will be limited in context? I don't want to set up different Redis servers for this purpose. I assume the answer is "No", and wonder why wasn't this implemented, as it seems to be a useful feature without too much overhead. 回答1: A Redis server can handle multiple databases... which are numbered. I

Data Modeling Best Practices in Firebase/AngularFire

我与影子孤独终老i 提交于 2019-12-09 07:10:20
问题 I'm developing an application in Firebase for the first time and was curious how I should model the data between two objects, a user and a post . I come from more of a relational db background and was curious not only how this would be done in nonrelational DBs but specifically how to set up a relationship between two objects in Firebase. For example, my application has many Users, and each user creates many Posts. User { firstName: String, lastname: String, userName: String } Post { title:

Cassandra: Column Family vs Super Column Family

笑着哭i 提交于 2019-12-09 06:52:30
问题 I have a requirement where i need my database to store the following data: - For each build, store the results of 3 performance runs. The result includes tps and latency. Reading up on cassandra data model, this directly maps to a super column family of the following format: BenchmarkSuperColumnFamily= { build_1: { Run1: {1000K, 0.5ms} Run2: {1000K, 0.5ms} Run3: {1000K, 0.5ms} } build_2: { Run1: {1000K, 0.5ms} Run2: {1000K, 0.5ms} Run3: {1000K, 0.5ms} } ... } But, i read in the following

Modelling blogs and ratings in mongodb and nodejs

↘锁芯ラ 提交于 2019-12-09 06:10:55
问题 I have a blogs collection that contains title, body and agrregate rating that the users have given to them. Another collection 'Ratings' whose schema has reference to the blog, user who rated(if at all he rates them) it in the form of their ObjectIds and the rating they have given ie., +1 or -1. When a particular user browses through blogs in the 'latest first' order (say 40 of them per page. Call them an array of blogs[0] to blogs[39] ) I have to retrieve the rating documents related to this

NoSQL databases - good candidates for log processing/aggregation and rollup? [closed]

落花浮王杯 提交于 2019-12-09 05:56:26
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 6 years ago . I have a MS SQL database that's used to capture bandwidth stats. We have a raw data table and to improve reporting speed at different