Unable to save array entry for list<text> column

Aperta
#84 12 commenti 0 reazioni 1 assegnatario Vedi su GitHub

@raymondfeng ci sta già lavorando.

Dal 22/10/2019.

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

bug

I am using Cassandra datasource in loopback 3, and trying to store values in list datatype column of a table(keyspace) of Cassandra datasource. But while creating an entry from loopback explorer, we are getting TypeError: Not a valid list value, expected Array obtained '["Morning","Afternoon","Evening"]'

Here is my loopback model:

{
  "name": "Time",
  "base": "PersistedModel",
  "idInjection": true,
  "options": {
    "validateUpsert": true
  },
  "properties": {
    "options": {
      "type": "array",
      "format": "list"
    }
  },
  "validations": [],
  "acls": [],
  "methods": {}
}

Tried debugging loopback-cassandra-datasource and saw options converted to string in params.

Data passed from loopback explorer:

{
  "options": ["Morning","Afternoon","Evening"]
}

Data logged from beforeRemote hook of the model:

{ options:
   [ 'Morning',
     'Afternoon',
     'Evening' ]
}

package.json

"dependencies": {
  "loopback": "3.26.0",
  "loopback-boot": "2.28.0",
  "loopback-component-explorer": "6.4.0"
  "loopback-connector-cassandra": "1.7.1"
}

The typeof options is object. I was debugging loopback cassandra connector and found typeof options as string in encoder.js of cassandra-driver node module. We have migrated from MongoDB to Cassandra and didn't face any issues for MongoDB driver. To what type or which format do I need to set for options property? Please let me know if any additional information required. Thank you in advance.

Lingua principale
JavaScript
Stelle
13
Fork
22
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.