MCPcopy Index your code
hub / github.com/deployd/deployd / collection

Function collection

lib/db.js:156–175  ·  view source on GitHub ↗
(store, fn)

Source from the content-addressed store, hash-verified

154}
155
156function collection(store, fn) {
157 var db = store._db;
158
159 return getConnection(db).then(function (mdb) {
160 return new Promise(function(resolve, reject) {
161 mdb.collection(store.namespace, function (err, collection) {
162 if(err || !collection) {
163 error(err || new Error('Unable to get ' + store.namespace + ' collection'));
164 process.exit(1);
165 }
166
167 if (fn) fn(null, collection);
168 resolve(collection);
169 });
170 });
171 }).catch(function (err) {
172 if (fn) fn(err);
173 throw err;
174 });
175}
176
177/**
178 * Returns a promise, or calls fn with the mongo collection served by this store

Callers 1

db.jsFile · 0.85

Calls 4

getConnectionFunction · 0.85
errorFunction · 0.85
fnFunction · 0.85
resolveFunction · 0.85

Tested by

no test coverage detected