NodeJS Mongo - Mongoose - Dynamic collection name
mongodb, mongoose, node.js, nosql
Solution
Collection name logic is hard coded all over the Moongose codebase such that client side partitioning is just not possible as things stands now.
My solution was to work directly with the mongo driver -
https://github.com/mongodb/node-mongodb-native
This proved great, the flexibility working with the driver directly allows for everything required and the Moongose overhead does not seem to add much in any case.
Problem
So, I want to create a client side based paritioning schema, where I set the collection name as function(), my pseudo code is something like that: ``` var mongoose = require('mongoose'), Schema = mongoose.Schema, var ConvForUserSchema = new Schema({ user_id: Number, conv_hash: String, archived: Boolean, unread: Boolean }, function CollectionName() { return (this.user_id % 10000); }); ``` Is this in any way possible through moongose such that both read and writes will work as expected?