-
-
Notifications
You must be signed in to change notification settings - Fork 168
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
What happened?
there are values that shouldn't be returned in a nested and or clause. e.g in the example i provided with the sample data. bob age 16 should not have been returned
Steps to reproduce
rust code sample data:
use helix_rs::{HelixDB, HelixDBClient};
use serde_json::json;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = HelixDB::new(Some("http://localhost"), Some(6969), None);
let users = vec![
("Alice", 25, "[email protected]"),
("Bob", 16, "[email protected]"),
("Alice", 17, "[email protected]"),
("Charlie", 30, "[email protected]"),
("Bob", 22, "[email protected]"),
];
for (name, age, email) in &users {
let _created: serde_json::Value = client
.query(
"CreateUser",
&json!({
"name": name,
"age": age,
"email": email,
}),
)
.await?;
}
let result: serde_json::Value = client.query("GetFilteredUsers", &json!({})).await?;
println!("Filtered users: {result:#?}");
Ok(())
}
query
QUERY GetFilteredUsers () =>
users <- N<User>::WHERE(
AND(
_::{age}::GT(18),
OR(_::{name}::EQ("Alice"), _::{name}::EQ("Bob"))
)
)
RETURN users
QUERY CreateUser (name: String, age: U8, email: String) =>
user <- AddN<User>({
name: name,
age: age,
email: email
})
RETURN user
schema:
N::User {
name: String,
age: U8,
email: String
}
Version
1.0.136
Environment
Development/Local
Relevant log output
Filtered users: Object {
"users": Array [
Object {
"age": Number(25),
"email": String("[email protected]"),
"id": String("1f094241-b818-6178-bfce-010203040506"),
"label": String("User"),
"name": String("Alice"),
},
Object {
"age": Number(16),
"email": String("[email protected]"),
"id": String("1f094241-b825-66d4-bfcf-010203040506"),
"label": String("User"),
"name": String("Bob"),
},
Object {
"age": Number(22),
"email": String("[email protected]"),
"id": String("1f094241-b849-6e1c-bfd2-010203040506"),
"label": String("User"),
"name": String("Bob"),
},
],
}Additional context
No response
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working