tigrisdata-archive / tigris-client-ts

TypeScript client for Tigris
https://www.tigrisdata.com/docs/sdkstools/typescript/
Apache License 2.0
15 stars 10 forks source link

Field with timetamp: "createdAt" not set on newly inserted document #245

Closed leggetter closed 1 year ago

leggetter commented 1 year ago

Given the following data model:

@TigrisCollection("posts")
class Post {
  @PrimaryKey(TigrisDataTypes.INT64, { order: 1, autoGenerate: true })
  id?: string;

  @Field()
  username!: string;

  @Field()
  text!: string;

  @Field(TigrisDataTypes.DATE_TIME, { timestamp: "createdAt" })
  createdAt?: Date;
}

export default Post;

And this code to insert a new User:

const post = await postsCollection.insertOne({ username: defaultUser.username, text: input.text })
console.log('new post on server', post);

Any ideas why the result of the console.log doesn't show a createdAt property on the newly created Post?

new post on server {
  username: 'leggetter',
  text: 'this is another post test',
  id: '1677074700254010134'
}

Note that the document does have a createdAt value when viewed in the web console and also when retrieving it via a query. It just seems to be a problem with the initial insertOne.

From @JigarJoshi :

raw response doesn't contain the entire payload. it contains some field and client stitches them together to form the inserted document. It needs to be fixed for TS client here.

ovaistariq commented 1 year ago

/bounty 100

algora-pbc[bot] commented 1 year ago

💎 $100.00 bounty created by ovaistariq 👉 To claim this bounty, submit a pull request that includes the text /claim #245 somewhere in its body 📝 To receive payouts, join Algora and complete the relevant onboarding steps 💵 Payment arrives in your account 2-5 days after the bounty is rewarded 💯 You keep 100% of the bounty award 🙏 Thank you for contributing to tigrisdata/tigris-client-ts!

algora-pbc[bot] commented 1 year ago

💡 akhill10 submitted a pull request that claims the bounty. You can visit your org dashboard to reward.

algora-pbc[bot] commented 1 year ago

🎉🎈 @akhill10 has been awarded $100.00! 🎈🎊

github-actions[bot] commented 1 year ago

:tada: This issue has been resolved in version 1.0.0-beta.45 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

github-actions[bot] commented 1 year ago

:tada: This issue has been resolved in version 1.0.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: