adonis-lucid-mongodb
Advanced tools
Comparing version 1.0.48 to 1.0.49
@@ -1,30 +0,55 @@ | ||
<a name="1.0.0"></a> | ||
## [1.0.0](https://github.com/duyluonglc/adonis-lucid-mongodb/releases/tag/v1.0.0) (2017-02-15) | ||
# Change Log | ||
All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). | ||
### Features | ||
Generated by [auto-changelog](https://github.com/CookPete/auto-changelog) | ||
* **migrae:** add support migration | ||
<a name="0.11.5"></a> | ||
## [0.11.5](https://github.com/duyluonglc/adonis-lucid-mongodb/releases/tag/v0.11.5) (2017-02-13) | ||
## [Unreleased](https://github.com/duyluonglc/adonis-lucid-mongodb/compare/1.0.49...HEAD) | ||
### Features | ||
* **query:** add support query by json object && query near | ||
## [1.0.49](https://github.com/duyluonglc/adonis-lucid-mongodb/compare/v1.0.0...1.0.49) - 2017-08-23 | ||
<a name="0.10.0"></a> | ||
## [0.10.0](https://github.com/duyluonglc/adonis-lucid-mongodb/releases/tag/v0.10.0) (2017-01-24) | ||
### Merged | ||
* Fix serialization for embeds/refers many [`#25`](https://github.com/duyluonglc/adonis-lucid-mongodb/pull/25) | ||
* Fix migration:status command [`#24`](https://github.com/duyluonglc/adonis-lucid-mongodb/pull/24) | ||
* getMigratedFiles should return plain array of strings [`#23`](https://github.com/duyluonglc/adonis-lucid-mongodb/pull/23) | ||
* fix bug withPivot method [`#12`](https://github.com/duyluonglc/adonis-lucid-mongodb/pull/12) | ||
* add morph one support [`#11`](https://github.com/duyluonglc/adonis-lucid-mongodb/pull/11) | ||
* Update chai to the latest version 🚀 [`#10`](https://github.com/duyluonglc/adonis-lucid-mongodb/pull/10) | ||
* Update dependencies to enable Greenkeeper 🌴 [`#3`](https://github.com/duyluonglc/adonis-lucid-mongodb/pull/3) | ||
### Features | ||
## [v1.0.0](https://github.com/duyluonglc/adonis-lucid-mongodb/compare/v0.11.5...v1.0.0) - 2017-02-15 | ||
* **relations:** add more relationship morphMany, embedOne, embedMany, referMany | ||
### Commits | ||
* add support migration [`0a1f4d7`](https://github.com/duyluonglc/adonis-lucid-mongodb/commit/0a1f4d752fdf35dc7104450b2d11889d46838bea) | ||
<a name="0.9.2"></a> | ||
## [0.9.2](https://github.com/duyluonglc/adonis-lucid-mongodb/releases/tag/v0.9.2) (2017-01-24) | ||
### refactor | ||
## [v0.11.5](https://github.com/duyluonglc/adonis-lucid-mongodb/compare/v0.10.7...v0.11.5) - 2017-02-13 | ||
* refactor(): refactored code for support mongodb | ||
### Commits | ||
* add file type geopoint & date [`c5fcdc7`](https://github.com/duyluonglc/adonis-lucid-mongodb/commit/c5fcdc7dea492c12ad4ef4a9faa84f0f81ef21e5) | ||
## v0.10.7 - 2017-02-08 | ||
### Fixed | ||
* feat(relations): filter results based upon relations [`#92`](https://github.com/duyluonglc/adonis-lucid-mongodb/issues/92) | ||
* feat(lucid): add incrementing flag [`#89`](https://github.com/duyluonglc/adonis-lucid-mongodb/issues/89) | ||
* feat(relations): add support for withTimestamps in belongsToMany [`#84`](https://github.com/duyluonglc/adonis-lucid-mongodb/issues/84) | ||
* fix(migrations): select column as {name} [`#82`](https://github.com/duyluonglc/adonis-lucid-mongodb/issues/82) | ||
* fix(database): rename pluck to pluckAll [`#81`](https://github.com/duyluonglc/adonis-lucid-mongodb/issues/81) | ||
* feat(relations): add support for managing pivot table [`#69`](https://github.com/duyluonglc/adonis-lucid-mongodb/issues/69) | ||
* fix(lucid:relations): implement delete method to delete relations [`#63`](https://github.com/duyluonglc/adonis-lucid-mongodb/issues/63) | ||
* style(command:reset): correct latest spelling [`#68`](https://github.com/duyluonglc/adonis-lucid-mongodb/issues/68) | ||
* fix(database): paginate count query to ignore order by [`#64`](https://github.com/duyluonglc/adonis-lucid-mongodb/issues/64) | ||
* feat(migrations): add migrations time in the console output [`#57`](https://github.com/duyluonglc/adonis-lucid-mongodb/issues/57) | ||
* fix(migrations): make sure schema callback is function before executing [`#60`](https://github.com/duyluonglc/adonis-lucid-mongodb/issues/60) | ||
* feat(database): add support for table prefixing [`#58`](https://github.com/duyluonglc/adonis-lucid-mongodb/issues/58) | ||
* docs(contributing): fix broken link [`#54`](https://github.com/duyluonglc/adonis-lucid-mongodb/issues/54) | ||
* feat(migrations): add support for making db actions [`#53`](https://github.com/duyluonglc/adonis-lucid-mongodb/issues/53) | ||
* fix(lucid): use primary key instead of id [`#51`](https://github.com/duyluonglc/adonis-lucid-mongodb/issues/51) | ||
* feat(lucid): add aggregates on relationship [`#48`](https://github.com/duyluonglc/adonis-lucid-mongodb/issues/48) | ||
* feat(lucid): add support for transactions [`#43`](https://github.com/duyluonglc/adonis-lucid-mongodb/issues/43) | ||
* fix(lucid:relations): keep relation output consistent [`#45`](https://github.com/duyluonglc/adonis-lucid-mongodb/issues/45) | ||
* fix(lucid): consider dirty values after beforeHooks [`#44`](https://github.com/duyluonglc/adonis-lucid-mongodb/issues/44) |
@@ -8,3 +8,3 @@ { | ||
}, | ||
"version": "1.0.48", | ||
"version": "1.0.49", | ||
"scripts": { | ||
@@ -11,0 +11,0 @@ "lint": "standard", |
@@ -7,10 +7,17 @@ # AdonisJS Lucid MongoDB | ||
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](http://standardjs.com/) | ||
[![Build Status](https://travis-ci.org/duyluonglc/adonis-lucid-mongodb.svg?branch=develop)](https://travis-ci.org/duyluonglc/adonis-lucid-mongodb) | ||
[![Coverage Status](https://img.shields.io/coveralls/duyluonglc/adonis-lucid-mongodb/develop.svg?style=flat-square)](https://coveralls.io/github/duyluonglc/adonis-lucid-mongodb?branch=develop) | ||
[![Downloads](https://img.shields.io/npm/dt/adonis-lucid-mongodb.svg?style=flat-square)](https://www.npmjs.com/package/adonis-lucid-mongodb) | ||
[![Greenkeeper badge](https://badges.greenkeeper.io/duyluonglc/adonis-lucid-mongodb.svg)](https://greenkeeper.io/) | ||
[![Build Status](https://travis-ci.org/duyluonglc/lucid-mongo.svg?branch=1.x)](https://travis-ci.org/duyluonglc/lucid-mongo) | ||
[![Coverage Status](https://img.shields.io/coveralls/duyluonglc/lucid-mongo/1.x.svg?style=flat-square)](https://coveralls.io/github/duyluonglc/lucid-mongo?branch=1.x) | ||
[![Greenkeeper badge](https://badges.greenkeeper.io/duyluonglc/lucid-mongo.svg)](https://greenkeeper.io/) | ||
> :pray: This repository is base on adonis-lucid. This package only work with mongodb. | ||
Adonis-lucid-mongodb is a mongo query builder and ORM for Adonis framework. It also has support for database migrations, seeds and factories as Adonis-lucid. | ||
### Breaking update | ||
Version 2.x was published to npm | ||
| Adonis version | Lucid Mongo version | | ||
| ------------- | ------------- | | ||
| 3.x.x | 1.x.x | | ||
| 4.x.x | 2.x.x | | ||
Adonis-lucid-mongodb is a mongo query builder and ODM for Adonis framework. It also has support for database migrations, seeds and factories as Adonis-lucid. | ||
You can learn more about AdonisJS and all of its awesomeness on http://adonisjs.com :evergreen_tree: | ||
@@ -143,13 +150,22 @@ | ||
```js | ||
const user = User.with('emails').find(1) | ||
const user = yield User.with('emails').find(1) | ||
const user = User.with('emails', 'phone').find(1) | ||
const user = yield User.with('emails', 'phone').fetch() | ||
const user = User.with(['emails', 'phone']).find(1) | ||
const user = yield User.with(['emails', 'phone']).fetch() | ||
const user = User.with({relation: 'email', 'scope': {where: {verified: true}, sort: '-age'}}).find(1) | ||
const user = yield User.with({ | ||
relation: 'familyMembers', | ||
scope: { | ||
where: { verified: true }, | ||
sort: '-age' | ||
} | ||
}).fetch() | ||
const user = User.with({relation: 'email', 'scope': query => { | ||
query.where(active, true).limit(1) | ||
}}).find(1) | ||
const user = yield User.with({ | ||
relation: 'familyMembers', | ||
scope: query => { | ||
query.where(active, true).where('age').lt(18) | ||
} | ||
}).fetch() | ||
@@ -156,0 +172,0 @@ ``` |
@@ -0,0 +0,0 @@ 'use strict' |
16
test.js
@@ -97,4 +97,16 @@ const config = { | ||
// const query = Country.query().where({name: 'ahihi'}) | ||
const user = await User.find('59834bf750e0cd1780e5a8c3') | ||
const users = await User.where({isActive: false}).fetch() | ||
const user = await User.find('59814572e30dfa2b74fc938f') | ||
// const cc = await user.hands().where({name: 'right'}).count() | ||
const planet = await Planet.first() | ||
await planet.users().where({isActive: true}).fetch() | ||
console.log(await planet.users().count()) | ||
await planet.users().update({ primary: 'key' }) | ||
console.log('==================================') | ||
await user.skills().fetch() | ||
console.log(await user.skills().count()) | ||
await user.skills().update({primary: 'key'}) | ||
// await user.skills().where({name: 'right'}).count() | ||
// console.log(cc) | ||
// await user.phoneNumbers().create({number: '1212121212'}) | ||
@@ -107,3 +119,3 @@ // await user.hands().create({name: 'right'}) | ||
// console.log(hands.toJSON()) | ||
console.log(user.toJSON()) | ||
// console.log(user.toJSON()) | ||
// await query.fetch() | ||
@@ -110,0 +122,0 @@ // const skill = await Skill.query().find('598ade40945a9f35c49e0ece') |
264810
8904
352