Meteor couchdb and File Storage


#1

I’m working with “Meteor database driver for CouchDB and Cloudant” package. And I came across this problem. While creating a new database in “imports/api/” export const Scores = new CouchDB.Database('scores'); everything seems to work just fine, just like with any other package.
But when I try to do the same in another package package, where I define a usage of meteor-couchdb package in package.js as api.use('cloudant:couchdb'); I get this error:

Error: Only lowercase letters (a-z), digits (0-9), and any of the characters _, $, (, ), +, -, and / are allowed. Moreover, the database name must begin with a letter.


#2

Can you show us your package code, in particular the part that calls new CouchDB.Database?


#3

There is just this part and it already generates that error.
api.use('cloudant:couchdb');
So there is no new CouchDB, but it will look like this
export const Scores = new CouchDB.Database('scores');


#4

Hmm - well that error is definitely a couchdb error, so your couchdb instance is getting passed in an invalid database name somehow. I’ve taken a quick look at the cloudant:couchdb package and I don’t see anything that would cause a default database connection to be established by just referencing the package in your package.js. Maybe try adding your new CouchDB.Database call to your package just to see what happens.


#5

Well I have tried to call new CouchDB.Database from that package api folder. And there is still same error. Also I want to note that with Mongo everything worked as it is. So there is no serious errors in the code or it’s architecture. Unless I’m missing something with CounchDB, and why it doesn’t want to work from another package but works from app itsef…


#6

I am not sure but suggest the following:

cloudant.db.create(dbCredentials.dbname);

This depends on what database you are using - Cloudant or CouchDB.

However the main difference is that the database name is an object and not a string.


#7

The error occurs without even creating a new DB. It occurs just by defining that the package will use another package with api.use('cloudant:couchdb'); so I’m not sure how creating a new DB while error is in the api.use will solve it. At the mean time I will try to reproduce similar environment in a new project and see what will happen, will get back with answers (hopefully).


#8

Hello guys, after many tries and fails. I deducted the problem.
So with cloudant:couchdb everything is okay, works when you define it in other packages and so on and on. api.use('cloudant:couchdb');
But the problem is here:
I also use 'cfs:standard-packages' and 'cfs:gridfs@0.0.33' packages for File storage. And this seems to cause the problem, as for some reason FS automatically instead of creating Collection tries to create database. It seems that these packages can’t be used together? Is there any packages for FS couchdb?