https://github.com/mongoosejs/mongoose-bson-timestamps
Implementation of BSON timestamp type for Mongoose
https://github.com/mongoosejs/mongoose-bson-timestamps
Last synced: 4 months ago
JSON representation
Implementation of BSON timestamp type for Mongoose
- Host: GitHub
- URL: https://github.com/mongoosejs/mongoose-bson-timestamps
- Owner: mongoosejs
- License: mit
- Created: 2024-06-24T19:47:38.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2024-06-24T20:42:19.000Z (12 months ago)
- Last Synced: 2025-02-22T21:26:10.620Z (4 months ago)
- Language: JavaScript
- Size: 5.86 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# mongoose-bson-timestamps
Implementation of BSON timestamp type for Mongoose## Usage
First, `npm install @mongoosejs/bson-timestamp` and import this package.
```javascript
// Using Node.js `require()`
const Timestamp = require('@mongoosejs/bson-timestamp');// Using ES6 imports
import Timestamp from '@mongoosejs/bson-timestamp';
```You can then use `Timestamp` as a schema type in your schema definitions.
```javascript
const Timestamp = require('@mongoosejs/bson-timestamp');
const mongoose = require('mongoose');const schema = new mongoose.Schema({
myTimestamp: { type: Timestamp }
});
```