npm package: @gfcc/mongo-tenant-repository
Description: Repositories and Services for mongo tenant
Author: Green Field Coding Company
Latest version: 2.1.0

# Mongo Tenant Repository

This module provides common, unified repository and model service
functionality in general and in multi tenancy context.

## API

### BaseRepository

```js
  getObjectId(id) : mongoose.Types.ObjectId

  getSchemaTypes() : mongoose.Types

  create(params, callback) : BaseRepository

  find(conditions, callback) : BaseRepository

  findById(entityId, callback) : BaseRepository

  findByIdAndUpdate(entityId, properties, options, callback) : BaseRepository

  findByIdAndRemove(entityId, callback) : BaseRepository

  findByCustomId(customId, callback) : BaseRepository

  findByCustomIdAndUpdate(customId, properties, options, callback) : BaseRepository

  findByCustomIdAndRemove(customId, callback) : BaseRepository

  findOneAndUpdate(conditions, properties, options, callback) : BaseRepository

  findOneAndRemove(conditions, callback) : BaseRepository

  findOne(query, callback) : BaseRepository

  findList(query, options, callback) : BaseRepository

  remove(conditions, callback) : BaseRepository

  findAndRemove(conditions, callback) : BaseRepository
```

### BaseRepositoryService

```js
  create(params, callback) : BaseRepositoryService

  findById(entityId, callback) : BaseRepositoryService

  findByIdAndUpdate(entityId, properties, options, callback) : BaseRepositoryService

  findByIdAndRemove(entityId, callback) : BaseRepositoryService

  findByCustomId(customId, callback) : BaseRepositoryService

  findByCustomIdAndUpdate(customId, properties, options, callback) : BaseRepositoryService

  findByCustomIdAndRemove(customId, callback) : BaseRepositoryService

  findOneAndUpdate(conditions, properties, options, callback) : BaseRepositoryService

  findOneAndRemove(conditions, callback) : BaseRepositoryService

  findOne(query, callback) : BaseRepositoryService

  findList(query, options, callback) : BaseRepositoryService
```

### MultiTenancyRepository

```js
  create(tenantId, params, callback) : MultiTenancyRepository

  find(tenantId, conditions, callback) : MultiTenancyRepository

  findById(tenantId, entityId, callback) : MultiTenancyRepository

  findByIdAndUpdate(tenantId, entityId, properties, options, callback) : MultiTenancyRepository

  findByIdAndRemove(tenantId, entityId, callback) : MultiTenancyRepository

  findByCustomId(tenantId, customId, callback) : MultiTenancyRepository

  findByCustomIdAndUpdate(tenantId, customId, properties, options, callback) : MultiTenancyRepository

  findByCustomIdAndRemove(tenantId, customId, callback) : MultiTenancyRepository

  findOneAndUpdate(tenantId, conditions, properties, options, callback) : MultiTenancyRepository

  findOneAndRemove(tenantId, conditions, callback) : MultiTenancyRepository

  findOne(tenantId, query, callback) : MultiTenancyRepository

  findList(tenantId, query, options, callback) : MultiTenancyRepository

  remove(tenantId, conditions, callback) : MultiTenancyRepository

  findAndRemove(tenantId, conditions, callback) : MultiTenancyRepository
```

### MultiTenancyRepositoryService

```js
  create(tenantId, params, callback) : MultiTenancyRepositoryService

  findById(tenantId, entityId, callback) : MultiTenancyRepositoryService

  findByIdAndUpdate(tenantId, entityId, properties, options, callback) : MultiTenancyRepositoryService

  findByIdAndRemove(tenantId, entityId, callback) : MultiTenancyRepositoryService

  findByCustomId(tenantId, customId, callback) : MultiTenancyRepositoryService

  findByCustomIdAndUpdate(tenantId, customId, properties, options, callback) : MultiTenancyRepositoryService

  findByCustomIdAndRemove(tenantId, customId, callback) : MultiTenancyRepositoryService

  findOneAndUpdate(tenantId, conditions, properties, options, callback) : MultiTenancyRepositoryService

  findOneAndRemove(tenantId, conditions, callback) : MultiTenancyRepositoryService

  findOne(tenantId, query, callback) : MultiTenancyRepositoryService

  findList(tenantId, query, options, callback) : MultiTenancyRepositoryService
```