Mongoose, CastError: Cast to Array failed for value when trying to save a model that contains a model

Man, I had a similar issue creating an Schema like this: QuestionnaireSchema = mongoose.Schema({ formId: Number, name: String, questions: [ { type: String, title: String, alternatives:[{ label: String, value: “Mixed” }] } ] }); My mistake was that I am using “type” as a field name and this is reserved word in mongoose. I just …

Read more

NoSQL and spatial data

graphs databases like Neo4j are a very good fit, especially as you can add different indexing schemes dynamically as you go. Typical stuff you can do on your base data is of course 1D indexing (e.g. Timline or B-Trees) or funkier stuff like Hilbert Curves etc, see Nick’s blog. Also, for some live demonstration, look …

Read more

Sorting on Multiple fields mongo DB

The MongoDB query optimizer works by trying different plans to determine which approach works best for a given query. The winning plan for that query pattern is then cached for the next ~1,000 queries or until you do an explain(). To understand which query plans were considered, you should use explain(1), eg: db.col.find({category:’A’}).sort({updated: -1}).explain(1) The …

Read more

How to choose between Cassandra, Membase, Hadoop, MongoDB, RDBMS etc.? [closed]

EDIT The NoSQL Ecosystem by Adam Marcus (from the book The Architecture of open source applications): http://www.aosabook.org/en/nosql.html general thoughts and comparison http://www.thoughtworks.com/articles/nosql-comparison technical comparison http://kkovacs.eu/cassandra-vs-mongodb-vs-couchdb-vs-redis a Master’s Thesis – Analysis and Classification of NoSQL Databases http://scholar.googleusercontent.com/scholar?q=cache:rQlbiz6bojAJ:scholar.google.com/+comparison+of+nosql&hl=en&as_sdt=0,5&as_vis=1

How to load 100 million records into MongoDB with Scala for performance testing?

Some tips : Do not index your collection before inserting, as inserts modify the index which is an overhead. Insert everything, then create index . instead of “save” , use mongoDB “batchinsert” which can insert many records in 1 operation. So have around 5000 documents inserted per batch. You will see remarkable performance gain . …

Read more

Use more than one schema per collection on mongodb

In mongoose you can do something like this: var users = mongoose.model(‘User’, loginUserSchema, ‘users’); var registerUser = mongoose.model(‘Registered’, registerUserSchema, ‘users’); This two schemas will save on the ‘users’ collection. For more information you can refer to the documentation: http://mongoosejs.com/docs/api.html#index_Mongoose-model or you can see the following gist it might help.

Scan HTable rows for specific column value using HBase shell

It is possible without Hive: scan ‘filemetadata’, { COLUMNS => ‘colFam:colQualifier’, LIMIT => 10, FILTER => “ValueFilter( =, ‘binaryprefix:<someValue.e.g. test1 AsDefinedInQuestion>’ )” } Note: in order to find all rows that contain test1 as value as specified in the question, use binaryprefix:test1 in the filter (see this answer for more examples)

Do NoSQL databases use or need indexes?

CouchDB and MongoDB definitely yes. I mentioned that in my book: http://use-the-index-luke.com/sql/testing-scalability/response-time-throughput-scaling-horizontal Here are the respective docs: http://guide.couchdb.org/draft/btree.html http://www.mongodb.org/display/DOCS/Indexes NoSQL is, however, too fragmented to give a definite “yes, all NoSQL systems need indexes”, I believe. Most systems require and provide indexes but not at level most SQL databases do. Recently, the Cassandra people were …

Read more