Skip to content

Commit

Permalink
feat(db-ql): add generate string id support
Browse files Browse the repository at this point in the history
  • Loading branch information
maslow committed Oct 7, 2021
1 parent 363f68b commit 7f01d5d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
},
"cSpell.words": [
"appid",
"bson",
"coll",
"dockerode",
"lafyun",
Expand Down
10 changes: 10 additions & 0 deletions packages/database-ql/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Command } from './command'
import { ServerDateConstructor } from './serverDate/index'
import { RegExpConstructor } from './regexp/index'
import { RequestInterface } from './interface'
import { ObjectId } from 'bson'

/**
* 地理位置类型
Expand Down Expand Up @@ -77,4 +78,13 @@ export class Db {
}
return new CollectionReference(this, collName)
}

/**
* Generate a hex string id for document
* @returns
*/
generateId(): string {
const id = new ObjectId()
return id.toHexString()
}
}

0 comments on commit 7f01d5d

Please sign in to comment.