schema-design

Maintaining Consistency Between JavaScript and C# Object Models

点点圈 提交于 2019-12-05 08:41:15
I'm working on an ASP.NET web application that uses a lot of JavaScript on the client side to allow the user to do things like drag-drop reordering of lists, looking up items to add to the list (like the suggestions in the Google search bar), deleting items from the list, etc. I have a JavaScript "class" that I use to store each of the list items on the client side as well as information about what action the user has performed on the item (add, edit, delete, move). The only time the page is posted to the server is when the user is done, right before the page is submitted I serialize all the

How to model many-to-many relationships in MongoDB (for a MySQL user)

夙愿已清 提交于 2019-12-04 19:19:46
问题 I come from a MySQL background and am trying to wrap my head around MongoDB . In particular, I'm struggling to conceptualize how I should model n:n relationships the "Mongo way." For this example, let's say we have two collections : users and interests . We need to be able to represent or query for several things in our data: User's interests User's rating of interest, e.g. "like" or "dislike" Users with a given interest Counter (which can be incremented/decremented) of each rating of the

MongoDB data schema performance

我是研究僧i 提交于 2019-12-04 15:43:05
I am trying to understand the internal allocation and placement of arrays and hashes (which, from my understanding are implemented through arrays) in MongoDB documents. In our domain we have documents with anywhere between thousands and hundreds of thousands of key-value pairs in logical groupings up to 5-6 levels deeps (think nested hashes). We represent the nesting in the keys with a dot, e.g., x.y.z , which upon insertion into MongoDB will automatically become something like: { "_id" : "whatever", "x" : { "y" : { "z" : 5 } } } The most common operation is incrementing a value, which we do

How to model many-to-many relationships in MongoDB (for a MySQL user)

淺唱寂寞╮ 提交于 2019-12-03 12:32:39
I come from a MySQL background and am trying to wrap my head around MongoDB . In particular, I'm struggling to conceptualize how I should model n:n relationships the "Mongo way." For this example, let's say we have two collections : users and interests . We need to be able to represent or query for several things in our data: User's interests User's rating of interest, e.g. "like" or "dislike" Users with a given interest Counter (which can be incremented/decremented) of each rating of the interest Interest name In MySQL , I would have created a users_interests table indexed on both user IDs

MongoDB Schema Design - Real-time Chat

那年仲夏 提交于 2019-12-02 17:18:00
I'm starting a project which I think will be particularly suited to MongoDB due to the speed and scalability it affords. The module I'm currently interested in is to do with real-time chat. If I was to do this in a traditional RDBMS I'd split it out into: Channel (A channel has many users) User (A user has one channel but many messages) Message (A message has a user) The the purpose of this use case, I'd like to assume that there will be typically 5 channels active at one time, each handling at most 5 messages per second. Specific queries that need to be fast: Fetch new messages (based on an

Is it possible to change the analyzer specified in the schema in Solr without reindexing from the original source?

谁说胖子不能爱 提交于 2019-11-29 04:53:27
In Solr, if we have a field in the schema with stored="true", and we change the analyzer associated with that field, is it possible to update just this field without reindexing all the documents? Could this be done using the "stored" values of the field with the new analyzer without going back to the original data source? Guy, I optimized your code. ... while (iter.hasNext()) { ... //server.deleteById(id) ; //server.commit() ; Collection<SolrInputDocument> docs = new ArrayList<SolrInputDocument>(); docs.add(inputdoc) ; server.add(docs) ; // server.commit() ; } server.commit() ; I found a way

Mongoose variable key name

你。 提交于 2019-11-28 12:11:59
I have a mongo object and wish to access it via mongoose for my web app. The schema I've defined has an Object storing user ids and a 3-level value (yes, maybe or no). e.g. "user_info": { "<id_value_1>": "y", "<id_value_2>": "n" } The id_value_* s above are the users session ids so a long string of random characters. How can I create a mongoose Schema for this? Would user_info: {String, String} work? I could restructure it so that the user_info is an array of objects { "sessionid": "<value>", "value: "y"} , which would be ok, is this the best option? You'll be better off if you avoid dynamic

What are the [dis]advantages of using a key/value table over nullable columns or separate tables?

折月煮酒 提交于 2019-11-28 03:21:03
I'm upgrading a payment management system I created a while ago. It currently has one table for each payment type it can accept. It is limited to only being able to pay for one thing, which this upgrade is to alleviate. I've been asking for suggestions as to how I should design it, and I have these basic ideas to work from: Have one table for each payment type, with a few common columns on each. (current design) Coordinate all payments with a central table that takes on the common columns (unifying payment IDs regardless of type), and identifies another table and row ID that has columns

Use more than one schema per collection on mongodb

允我心安 提交于 2019-11-27 19:02:25
I wanted to use more than one schema per collection in mongodb , how to use it....? It gives me this error when I try to run it: Error: OverwriteModelError: Cannot overwrite allUsers model once compiled. OverwriteModelError: Cannot overwrite checkInOut model once compiled. Heres my schema.js var mongoose = require('mongoose'); var Schema = mongoose.Schema , ObjectId = Schema.ObjectId; var checkInInfoSchema= new Schema({ name:String, loginSerialId:Number }); var loginUserSchema = new Schema({ sn : { type: Number, unique:true } ,uname: {type:String, unique:true} ,pass:String }); var

Is it possible to change the analyzer specified in the schema in Solr without reindexing from the original source?

故事扮演 提交于 2019-11-27 18:43:52
问题 In Solr, if we have a field in the schema with stored="true", and we change the analyzer associated with that field, is it possible to update just this field without reindexing all the documents? Could this be done using the "stored" values of the field with the new analyzer without going back to the original data source? 回答1: Guy, I optimized your code. ... while (iter.hasNext()) { ... //server.deleteById(id) ; //server.commit() ; Collection<SolrInputDocument> docs = new ArrayList