NoSQL YAML format

Hi All,

We are doing some POC for the NOSQL(Mongodb). We have are using yaml format to write a changelog. We have created sample yaml format and try to execute. but we are facing below issue

  1. The Schema Validators are not getting created though there are no errors during collection creation.
  2. The Create index is showing the error as key field cannot be blank though we are passing all the key field properly.
  3. Insert one and insert many records are getting executed successfully but records are not getting created in DB. Only object reference is getting created.

Can someone help me how to write the yaml format for nosql. Better if you have any sample to create collection, index and insert record please share.

Sample yaml file i have created but not working :frowning:

databaseChangeLog:

  • changeSet:
    id: ‘1’
    author: admin
    comment: Create entitydetailsYAML collection
    changes:
    • createCollection:
      collectionName: entitydetailsYAML
      options:
      “$rawJson”:
      validator:
      “$jsonSchema”:
      required:
      - nameSpace
      - entityName
      - entityClientType
      properties:
      entityClientType:
      enum:
      - commonCode
      - propertyManager
      - recordStyled
      description: can only be either commonCode, propertyManager or
      recordStyled
      uniqueConstraint:
      bsonType:
      - array
      minItems: 0
      uniqueItems: false
      validationAction: warn
      validationLevel: strict
  • changeSet:
    id: ‘2’
    author: admin
    comment: Create entitydetailsYAML index
    changes:
    • createIndex:
      collectionName: entitydetailsYAML
      keys:
      “$rawJson”:
      nameSpace: 1
      entityName: 1
      entityClientType: 1
      options:
      “$rawJson”:
      unique: true
      name: ui_tppEntityDetails
  • changeSet:
    id: ‘3’
    author: Arshad
    comment: Populate entitydetailsYAML table
    changes:
    • insertOne:
      collectionName: entitydetailsYAML
      document:
      “$rawJson”:
      nameSpace: payment
      entityName: stringConstant
      entityClientType: stringConstant
      entitySchema: {}
      uniqueConstraint:
    • insertMany:
      collectionName: entitydetailsYAML
      documents:
      “$rawJson”:
      - nameSpace: payment
      entityName: commonCodes
      entityClientType: commonCode
      entitySchema: {}
      uniqueConstraint:
      - nameSpace: payment
      entityName: propertyManager
      entityClientType: propertyManager
      entitySchema: {}
      uniqueConstraint:

Hi @Zabi - thanks for sharing your question.

I don’t think YAML changelogs are compatible with the MongoDB extension at this time. Please file an issue here: Issues · liquibase/liquibase-mongodb · GitHub

Thanks,
Tabby