다음 SailsJS 서버가 재설정 될 때까지 워터 라인 고유 유효성 검사가 감지되지 않음

StackOverflow https://stackoverflow.com//questions/23000494

  •  20-12-2019
  •  | 
  •  

문제

나는 돛 @ beta를 사용하고 있습니다.

나는 여러 개의 방 모델을 만들려고 노력하고 있습니다 (정의 참조).

'say'server 의 다음 재시작이 다음을 다시 시작할 때까지 유효성 검사가 감지되지 않으면 다음과 같은 출력을 얻습니다.

C:\eMali_dev\server>sails lift

info: Starting app...

Express midleware for passport
Waterline encountered a fatal error when trying to perform the `alter` auto-migration strategy.
In a couple of seconds, the data (cached in memory) will be logged to stdout.
(a failsafe put in place to preserve development data)

In the mean time, here's the error:

Error (E_UNKNOWN) :: Encountered an unexpected error:
MongoError: E11000 duplicate key error index: eMali_beta_dev.room.$name_1  dup key: { : "e1" }
Details:
{ error: 'E_UNKNOWN',
  summary: 'Encountered an unexpected error',
  status: 500,
  raw: 'MongoError: E11000 duplicate key error index: eMali_beta_dev.room.$name_1  dup key: { : "e1" }' }


================================
Data backup:
================================

[ { name: 'e1',
    center: '53471e2318b931dc1b69f3a8',
    min_age: 1,
    max_age: 6,
    createdAt: Fri Apr 11 2014 00:41:39 GMT+0200 (W. Europe Summer Time),
    updatedAt: Fri Apr 11 2014 00:41:39 GMT+0200 (W. Europe Summer Time),
    _id: { _bsontype: 'ObjectID', id: 'SG\u001e#\u001811Ü\u001bióc' } },
  { name: 'e2',
    center: '53471e2318b931dc1b69f3a8',
    min_age: 1,
    max_age: 7,
    createdAt: Fri Apr 11 2014 00:41:39 GMT+0200 (W. Europe Summer Time),
    updatedAt: Fri Apr 11 2014 00:41:39 GMT+0200 (W. Europe Summer Time),
    _id: { _bsontype: 'ObjectID', id: 'SG\u001e#\u001811Ü\u001bióª' } },
  { name: 'e1',
    center: '53471e2318b931dc1b69f3a8',
    min_age: 1,
    max_age: 6,
    createdAt: Fri Apr 11 2014 00:41:39 GMT+0200 (W. Europe Summer Time),
    updatedAt: Fri Apr 11 2014 00:41:39 GMT+0200 (W. Europe Summer Time),
    _id: { _bsontype: 'ObjectID', id: 'SG\u001e#\u001811Ü\u001bió«' } } ]
error: A hook (`orm`) failed to load!
.

방 모델 :

module.exports = {

    schema: true,

    attributes: {

        name: {
            type: 'string',
            required: true,
            unique: true,
            minLength: 3
        },

        center: {
            model: 'center'
        },

        min_age: {
            type: 'integer',
            required: true
        },

        max_age: {
            type: 'integer',
            required: true
        }
    }
}
.

도움이 되었습니까?

해결책

이것은 돛의 버그 였고 고정되었습니다.모두 감사합니다

다른 팁

기본 디스크 데이터베이스에서 원하는 데이터베이스로 데이터베이스를 변경해야합니다. 나는 비슷한 문제에 직면하고 "디스크"에서 "mongodb"로 데이터베이스를 변경했습니다. 기본 데이터베이스가 고유 한 제약 조건을 적용 할 수 없습니다.

나는 당신의 문제를 해결하기를 바랍니다.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top