How should the model design be?

2 views
Skip to first unread message

Burhan GÖKSEL

unread,
Jul 26, 2022, 10:29:47 AMJul 26
to MongoEngine Users
Greetings To You All,

Query get method works, but insert with mutation does not.

My Model:
class Artifact(Document):
name = StringField()
list = ListField(DictField())

My Query:
"data": {
    "x": [
      {
        "id": "62dfe8a35de7c5c67a51d7e2",
        "name": "burhan",
        "list": [
          "{\"name\": \"burhan\", \"gender\": \"man\", \"age\": \"24"}",
          "{\"name\": \"burhan\", \"gender\": \"man\", \"age\": \"24\"}"
        ]
      },
      {
        "id": "62dff1b21a559df6e94838ac",
        "name": "id",
        "cef": null
      }
    ]
  }

Thank you very much in advance to those who help.

Clara Daia

unread,
Jul 26, 2022, 10:59:19 AMJul 26
to mongoeng...@googlegroups.com
Hi Burhan,

Can you show the code you are running with the mutation and the error message?

By the way, I would not call your attribute "list" as "list" is also a built-in function and it can cause problems down the line.

Best,
Clara

--
You received this message because you are subscribed to the Google Groups "MongoEngine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongoengine-us...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongoengine-users/1d940891-5596-413f-95d6-f14029dba4d1n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages