Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 5 additions & 10 deletions src/ExportAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@ var transform = require('./transform');

// options can contain:
// collectionPrefix: the string to put in front of every collection name.
function ExportAdapter(mongoURI, options) {
function ExportAdapter(mongoURI, options = {}) {
this.mongoURI = mongoURI;
options = options || {};

this.collectionPrefix = options.collectionPrefix;

Expand Down Expand Up @@ -63,8 +62,7 @@ function returnsTrue() {
// Returns a promise for a schema object.
// If we are provided a acceptor, then we run it on the schema.
// If the schema isn't accepted, we reload it at most once.
ExportAdapter.prototype.loadSchema = function(acceptor) {
acceptor = acceptor || returnsTrue;
ExportAdapter.prototype.loadSchema = function(acceptor = returnsTrue) {

if (!this.schemaPromise) {
this.schemaPromise = this.collection('_SCHEMA').then((coll) => {
Expand Down Expand Up @@ -277,8 +275,7 @@ ExportAdapter.prototype.removeRelation = function(key, fromClassName,
// acl: a list of strings. If the object to be updated has an ACL,
// one of the provided strings must provide the caller with
// write permissions.
ExportAdapter.prototype.destroy = function(className, query, options) {
options = options || {};
ExportAdapter.prototype.destroy = function(className, query, options = {}) {
var isMaster = !('acl' in options);
var aclGroup = options.acl || [];

Expand Down Expand Up @@ -346,8 +343,7 @@ ExportAdapter.prototype.create = function(className, object, options) {
// This should only be used for testing - use 'find' for normal code
// to avoid Mongo-format dependencies.
// Returns a promise that resolves to a list of items.
ExportAdapter.prototype.mongoFind = function(className, query, options) {
options = options || {};
ExportAdapter.prototype.mongoFind = function(className, query, options = {}) {
return this.collection(className).then((coll) => {
return coll.find(query, options).toArray();
});
Expand Down Expand Up @@ -503,8 +499,7 @@ ExportAdapter.prototype.smartFind = function(coll, where, options) {
// TODO: make userIds not needed here. The db adapter shouldn't know
// anything about users, ideally. Then, improve the format of the ACL
// arg to work like the others.
ExportAdapter.prototype.find = function(className, query, options) {
options = options || {};
ExportAdapter.prototype.find = function(className, query, options = {}) {
var mongoOptions = {};
if (options.skip) {
mongoOptions.skip = options.skip;
Expand Down
5 changes: 2 additions & 3 deletions src/RestQuery.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,12 @@ var Parse = require('parse/node').Parse;
// include
// keys
// redirectClassNameForKey
function RestQuery(config, auth, className, restWhere, restOptions) {
restOptions = restOptions || {};
function RestQuery(config, auth, className, restWhere = {}, restOptions = {}) {

this.config = config;
this.auth = auth;
this.className = className;
this.restWhere = restWhere || {};
this.restWhere = restWhere;
this.response = null;

this.findOptions = {};
Expand Down