cacheman-mongo icon indicating copy to clipboard operation
cacheman-mongo copied to clipboard

mongodb native mode is no more supported after upgrade to 1.0.3

Open ahmad2x4 opened this issue 9 years ago • 2 comments

Hi

I have and issue after upgrade from 1.0.1 to 1.0.3.

TypeError: Object #<NativeConnection> has no method 'ensureIndex'

in version 1.0.3 there is new lines which calls ensureIndex. Since this does not exist in native mode above error get thrown

basically I try to run following code

var mongoose = require('mongoose');
var CachemanMongo = require('cacheman-mongo');

console.log('Setting up mongoose');

var mongoose_db;
var cache;
var connect = function() {
    var options = {
        server: {
            socketOptions: {
                keepAlive: 1
            }
        }
    };

    databaseURL = 'codolutionstest.com:27017/mydb';

    mongoose_db = mongoose.createConnection(databaseURL, options);
    cache = new CachemanMongo({
        client: mongoose_db,
        collection: 'cacheman'
    });
};


connect();


mongoose_db.on('error', console.log);
mongoose_db.on('disconnected', connect);


cache.get('cacheKey', function(err, data) {
    console.log(data);
});

ahmad2x4 avatar Feb 01 '16 11:02 ahmad2x4

+1

YouriT avatar Feb 09 '16 11:02 YouriT

Hi guys, I will check this out tonight!

On Tue, Feb 9, 2016 at 5:32 AM, Youri [email protected] wrote:

+1

— Reply to this email directly or view it on GitHub https://github.com/cayasso/cacheman-mongo/issues/12#issuecomment-181826344 .

J.B.

cayasso avatar Feb 09 '16 15:02 cayasso