-
Notifications
You must be signed in to change notification settings - Fork 869
Open
Labels
Description
My Environment
ArangoDB Version: 3.12.5
Deployment Strategy: Docker Compose
Operating System: Linux
Used Package: Docker image
Steps to reproduce
- Create a collection and setting a rule with "multipleOf" = 0.01
"rule": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"amount": {
"type": "number",
"multipleOf": 0.01,
},
},
"required": [
"amount",
],
"uniqueItems": true
}
or you can get Schema online
- Try insert data {"amount": 1.25} and {"amount": 111.25}:
from arango import ArangoClient
client = ArangoClient(hosts="http://127.0.0.1:8529")
db = client.db(db_name, username="root", password="")
accounts_collection = db.collection("accounts")
try:
aa = 1.25
res = accounts_collection.insert({"amount": aa,})
print(aa,
62FA
res)
except Exception as e:
print(aa, e.__class__)
try:
aa = 111.25
res = accounts_collection.insert({"amount": aa,})
print(aa, res)
except Exception as e:
print(aa, e.__class__)
Result shows:
1.25 {'_id': 'accounts/609256', '_key': '609256', '_rev': '_kDjmgwG---'}
111.25 <class 'arango.exceptions.DocumentInsertError'>
I dont know if i misunderstood multipleOf
, so i used online validation tool: https://www.jsonschemavalidator.net/s/hGc8KQ2F
which create a same JSON Schema and {"amount": 111.25} passed it.
I would be grateful if someone could help me figure it out.