本文整理汇总了TypeScript中mongodb.ObjectId.toHexString方法的典型用法代码示例。如果您正苦于以下问题:TypeScript ObjectId.toHexString方法的具体用法?TypeScript ObjectId.toHexString怎么用?TypeScript ObjectId.toHexString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mongodb.ObjectId
的用法示例。
在下文中一共展示了ObjectId.toHexString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it('should return the raw transform object if options field exists and set to true', () => {
let id = new ObjectId();
let coin = {
_id: id,
network: 'regtest',
chain: 'BTC',
mintTxid: '81f24ac62a6ffb634b74e6278997f0788f3c64e844453f8831d2a526dc3ecb13',
mintIndex: 0,
mintHeight: 1,
coinbase: true,
value: 5000000000.0,
address: 'n1ojJtS98D2VRLcTkaHH4YXLG4ytCyS7AL',
script: Buffer.from(''),
wallets: [],
spentTxid: '',
spentHeight: SpentHeightIndicators.unspent
} as ICoin;
const result = CoinStorage._apiTransform(coin, { object: true });
expect(result).to.deep.equal({
_id: id.toHexString(),
mintTxid: '81f24ac62a6ffb634b74e6278997f0788f3c64e844453f8831d2a526dc3ecb13',
network: 'regtest',
chain: 'BTC',
spentTxid: '',
mintHeight: 1,
mintIndex: 0,
spentHeight: SpentHeightIndicators.unspent,
address: 'n1ojJtS98D2VRLcTkaHH4YXLG4ytCyS7AL',
coinbase: true,
confirmations: -1,
script: '',
value: 5000000000.0
});
});
示例2: stringifyId
static stringifyId(id: ObjectId): string {
return id.toHexString();
}