Private add method
@param  {Class} model A Model instance
@param {Number} at The index at which the model should be inserted
@return {Class} Collection Instance
557555
function(model, at){
        model = new this._Model(model, this.options.Model.options);

        if (!this.hasModel(model)) {
            // Attach events to the model that will signal collection events
            this.attachModelEvents(model);

            // If _models is empty, then we make sure to push instead of splice.
            at = this.length == 0 ? void 0 : at;

            if (at != void 0) {
                this._models.splice(at, 0, model);
            } else {
                this._models.push(model);
            }

            this.length = this._models.length;

            this._changed = true;

            // if at is undefined, then it would be at the end of the array, thus this.length-1
            this.signalAdd(model, at != void 0 ? at : this.length - 1);
        }

        return this;
    }
1363074
function(model, name) {
                if (!model.resource) {
                    return;
                }

                var resource = model.resource.replace(/\/+$/, "");
                if (name === "findAll" || name === "create") {
                    return resource;
                } else {
                    return resource + "/{" + model.id + "}";
                }
            }
396072
function( model ) {
			if ( model instanceof Backbone.RelationalModel ) {
				model = model.constructor;
			}
			
			var rootModel = model;
			while ( rootModel._superModel ) {
				rootModel = rootModel._superModel;
			}
			
			var coll = _.detect( this._collections, function( c ) {
					return c.model === rootModel;
				});
			
			if ( !coll ) {
				coll = this._createCollection( rootModel );
			}
			
			return coll;
		}
1003482
function add(value) {
	    return _collectionStrong.def(_validateCollection(this, SET), value = value === 0 ? 0 : value, value);
	  }
53825
function( model ) {
			var coll = this.getCollection( model );
			coll._onModelEvent( 'change:' + model.idAttribute, model, coll );
		}
107657
def register_model(self, model_cls):
        """"""
        if not getattr(model_cls, '_database_'):
            raise ModelAttributeError('_database_ missing '
                                      'on %s!' % model_cls.__name__)
        if not getattr(model_cls, '_collection_'):
            raise ModelAttributeError('_collection_ missing '
                                      'on %s!' % model_cls.__name__)

        model_cls._mongo_client_ = self.client

        logging.info('Registering Model ' + model_cls.__name__)
        return model_cls
361438
function(model, options) {
            options || (options = {});
            if (!(model instanceof Model)) {
                var attrs = model;
                options.collection = this;
                model = new this.model(options, attrs);
            } else if (!model.collection) {
                model.collection = this;
            }
            return model;
        }
1257522
function newCollection(_params, _scope) {
      var col = new Collection();
      col.$scope = _scope || Model;
      col.$params = _params;
      col.$initialize();
      return col;
    }
605489
function(model, options) {
          model.id = Backbone.Firebase._getKey(this.firebase.push());
          options = _.extend({ autoSync: false }, options);
          return Backbone.Collection.prototype.create.apply(this, [model, options]);
        }
951071
function(model, options) {
    options = options ? _.clone(options) : {};
    if (!(model = this._prepareModel(model, options))) return false;
    if (!options.wait) this.add(model, options);
    return this._callAdapter('addToIndex', options, model);
  }
169271
function(model, options) {
            model = this._prepareModel(model, options);
            this.add(model, options);
            return model;
        }
930408
function(models, options) {
            options = _.defaults(options || {}, {
                totalCount: false
            });

            // Manage {list:[], n:0} for infinite list
            if (_.size(models) == 2
            && models.list != null && models.n != null) {
                this._totalCount = models.n;
                return this.reset(models.list, options);
            }

            // Remove reference
            for (var i = 0, length = this.models.length; i < length; i++) {
                this._removeReference(this.models[i], options);
            }
            options.previousModels = this.models;
            this.options.startIndex = 0;
            this.models = [];
            this._byId = {};
            if (options.totalCount) this._totalCount = null;
            this.add(models, _.extend({silent: true}, options || {}));
            options = _.defaults(options || {}, {
                silent: false
            });
            if (!options.silent) this.trigger('reset', this, options);
            return this;
        }
567902
function(model) {

    const modelPrev = model.collection.prev(model);
    const modelNext = model.collection.next(model);
    let mPrevSel, mNextSel;
    if ((typeof modelPrev !== "undefined" && modelPrev !== null)) { mPrevSel = this._getSelection(modelPrev); }
    if ((typeof modelNext !== "undefined" && modelNext !== null)) { mNextSel = this._getSelection(modelNext); }
    return [mPrevSel,mNextSel];
  }
300030
public function add($model)
    {
        if (is_array($model)) {
            // @note: add model type validation.
            $this->collection[] = MarketModel::getInstance($model);
        } elseif (is_object($model) && $model instanceof MarketModel) {
            $this->collection[] = $model;
        }

        return $this;
    }
154621
function(model, options) {
      if (!(model instanceof Parse.Object)) {
        var attrs = model;
        options.collection = this;
        model = new this.model(attrs, options);
        if (!model._validate(model.attributes, options)) {
          model = false;
        }
      } else if (!model.collection) {
        model.collection = this;
      }
      return model;
    }
941087
function(models, options) {
      models  || (models = []);
      options || (options = {});
      this.each(this._removeReference);
      this._reset();
      this.add(models, {silent: true});
      if (!options.silent) this.trigger('reset', this, options);
      return this;
    }
895728
function appendModel(url, model, done){
		var list = utils.flatten_tree(JSON.parse(JSON.stringify(model)))

		var errormodel = null

		list = list.filter(function(model){
			if(!model._digger.path || !model._digger.inode){
				errormodel = model;
				return false;
			}
			return true
		})

		if(errormodel){
			return done('no path or inode in level-append: ' + JSON.stringify(model))
		}

		var batch = list.map(function(model){
			return {
				type:'put',
				key:model._digger.path + '/' + model._digger.inode,
				value:model
			}
		})

		tree.batch(batch, function(err){
			if(err) return done(err)
			done(null, model)
		})
	}