Optional keyspaceThe keyspace to use for the operation.
Optional maxThis temporary error-ing property exists for migration convenience, and will be removed in a future version.
maxTimeMS option is no longer available; the timeouts system has been overhauled, and timeouts should now be set using timeout, and defaults in timeoutDefaults. You may generally Ctrl+R replace maxTimeMS with timeout to retain the same behavior.Optional nameIf true, only the name of the UDTs is returned.
If false, the full UDT info is returned.
Defaults to false.
const names = await db.listTypes({ nameOnly: true });
console.log(names); // ['address', 'user_profile']
const info = await db.listTypes({ nameOnly: false });
console.log(info); // [{ name: 'address', definition: { fields: { ... } } }]
false
Optional namespaceThis temporary error-ing property exists for migration convenience, and will be removed in a future version.
namespace terminology has been removed, and replaced with keyspace throughout the client.Optional timeoutLets you specify timeouts for individual methods, in two different formats:
// Both `requestTimeoutMs` and `generalMethodTimeoutMs` are set to 1000ms.
await coll.insertOne({ ... }, { timeout: 1000 });
// `requestTimeoutMs` is left as default, `generalMethodTimeoutMs` is set to 2000ms.
await coll.insertOne({ ... }, { timeout: { generalMethodTimeoutMs: 2000 } });
// Both `requestTimeoutMs` and `generalMethodTimeoutMs` are set to 2000ms.
await coll.insertMany([...], {
timeout: { requestTimeoutMs: 2000, generalMethodTimeoutMs: 2000 },
});
// `requestTimeoutMs` is left as default, `generalMethodTimeoutMs` is set to 2000ms.
await coll.insertMany([...], { timeout: 2000 });
// `requestTimeoutMs` is left as default, `generalMethodTimeoutMs` is set to 2000ms.
await coll.insertMany([...], { timeout: { generalMethodTimeoutMs: 2000 } });
// Both `requestTimeoutMs` and `generalMethodTimeoutMs` are set to 2000ms.
await coll.insertMany([...], {
timeout: { requestTimeoutMs: 2000, generalMethodTimeoutMs: 2000 },
});
See TimeoutDescriptor for much more information.
TimeoutDescriptor
Options for listing user-defined types.
Field
nameOnly - If true, only the name of the UDTs is returned. If false, the full UDT info is returned. Defaults to false.
Field
keyspace - Overrides the keyspace to list UDTs from. If not provided, the default keyspace is used.
Field
timeout - The timeout overrides for this method
See
Db.listTypes