-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: Does not save all the values. #219
Comments
Hello, thanks for opening this issue! I noticed that, while most fields become
Finally, it would be interesting to see any |
In addition to @finnbear comment, could you get a list of field definitions with |
Thank you for your response: |
Alrighty, raises some more questions for me:
|
Hi again. I checked everything and did multiple debugs agan. The problem is not in database but in api.
works just fine, but when i try to use prepared statement, like:
or
, it stops working |
@kearfy could you take a look? |
what will happen if you remove: if (result.length < 0 || result[0].result.length < 1) {
return null;
} and change: return result[0].result[0]; to return result[0][0] It's just a guess from my side as its hard to reproduce your problem, as you provide only part of your code. But I'm pretty sure that is problem how you accessing response data. If the above will not help, just try to find a minimal code that will result with your problem. For example, start with: Check what is returned from SurrealDB, (do not wrap it in any extra functions): const query = 'SELECT username, email, surname, lastname, type, token, logged_in, class, timetable, password FROM users WHERE username = $username;';
const params = {
username: 'test' // make sure that user with username = 'test' exists in database
};
const test = async () => {
try {
const result = await db.query(query, params);
console.log({ response: result[0][0] });
} catch (error) {
console.error('error:', error);
}
}; Then check what is logged out. Is it error or result? Is it an array or object? I think that kind of the problem can be as well a mismatch with the permissions on table or authentication itself or even typo on table name (is it users? or user?). Let us know what is returned from the above code and then will be much easier to determine where the problem is. |
I think that should prevent to lead to problems like surrealdb/surrealdb.js#219
I think the problem here was the example in docs not updated to |
Describe the bug
Hi. I am pretty new to Surreal, so excuse me if I'm asking a dumb question, but I wasnt abe to find enough Information in docs. When I am creating a user, and then requesting it using Typescript and surrealdb.js, the user is created and is can be queried just normal:
But when I restart the application and query it again, this is the object I get:
Maybe it has something to do with the way Ts, or better to say Js Runtime is sting the data, but I have no Idea, why such a bug happens. Here is the code to create a user:
And here is the code I am sing to query it:
Maybe I kinda misunderstood the Surrealdb SQL syntax. Before using this code I covered it with tests and this is why I was sure everything should work just fine.
P.S. I also tried Select * ...
Here are the code snippets in case you want to copy them: ` try {
const query = "
SELECT username, email, surname, lastname, type, token, logged_in, class, timetable, password
FROM type::table($tb)
WHERE username = $username";
let created = await db.create("users:"+username,{ username: username, password: password, email: email, surname: surname, lastname: lastname, type: type, token: '', logged_in: false, class: null, timetable: null });
Steps to reproduce
Execute the SELECT statement
Expected behaviour
It always should return the
SurrealDB version
1.0.0-beta.9+20230402.5eafebd for windows on x86_64
Contact Details
dikovmax04@gmail.com.
Is there an existing issue for this?
Code of Conduct
The text was updated successfully, but these errors were encountered: