Merge pull request #729 from ParsePlatform/nlutsenko.decouple.schema

Decouple and remove direct mongo access from Schema/SchemaRouter.
This commit is contained in:
Nikita Lutsenko
2016-02-29 23:53:01 -08:00
6 changed files with 200 additions and 250 deletions

View File

@@ -30,6 +30,17 @@ export class MongoStorageAdapter {
});
}
collectionExists(name: string) {
return this.connect().then(() => {
return this.database.listCollections({ name: name }).toArray();
}).then(collections => {
return collections.length > 0;
});
}
dropCollection(name: string) {
return this.collection(name).then(collection => collection.drop());
}
// Used for testing only right now.
collectionsContaining(match: string) {
return this.connect().then(() => {