Skip to content
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

UUID is not available #20

Closed
narumincho opened this issue Nov 5, 2022 · 3 comments
Closed

UUID is not available #20

narumincho opened this issue Nov 5, 2022 · 3 comments

Comments

@narumincho
Copy link

import { MongoClient, UUID } from "https://deno.land/x/atlas_sdk@v1.0.3/mod.ts";

const client = new MongoClient({
  endpoint: "https://data.mongodb-api.com/app/YOUR_APP_ID/endpoint/data/v1",
  dataSource: "YOUR_CLUSTER_NAME",
  auth: {
    apiKey: "YOUR_API_KEY",
  },
});

await client.database("sampleDatabase").collection("sampleCollection").insertOne({
  sampleUUID: new UUID(),
})

Error when trying to create document with uuid

error: Uncaught BSONTypeError: Unrecognized or invalid _bsontype: UUID
        throw new BSONTypeError(
              ^
    at serializeDocument (https://deno.land/x/web_bson@v0.2.5/src/extended_json.ts:318:15)
    at serializeValue (https://deno.land/x/web_bson@v0.2.5/src/extended_json.ts:253:12)
    at serializeDocument (https://deno.land/x/web_bson@v0.2.5/src/extended_json.ts:300:22)
    at serializeValue (https://deno.land/x/web_bson@v0.2.5/src/extended_json.ts:253:12)
    at serializeDocument (https://deno.land/x/web_bson@v0.2.5/src/extended_json.ts:300:22)
    at serializeValue (https://deno.land/x/web_bson@v0.2.5/src/extended_json.ts:253:12)
    at Module.stringify (https://deno.land/x/web_bson@v0.2.5/src/extended_json.ts:469:15)
    at Collection.callApi (https://deno.land/x/atlas_sdk@v1.0.3/client.ts:216:19)
    at Collection.insertOne (https://deno.land/x/atlas_sdk@v1.0.3/client.ts:81:17)
@erfanium
Copy link
Owner

erfanium commented Nov 6, 2022

Seems a x/web_bson bug. I'll work on it

cc @lucsoft

@lucsoft
Copy link

lucsoft commented Nov 6, 2022

It's not a bug actually I think

We just are not up to date anymore and we need to pull from upstream

As I'm pretty sure they change upstream how they handle uuids

@erfanium
Copy link
Owner

erfanium commented Feb 1, 2023

@narumincho
It's now fixed on newer atlas_sdk version.
Thanks for reporting this

@erfanium erfanium closed this as completed Feb 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants