Skip to content

Commit

Permalink
260th Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Shyam-Chen committed Feb 18, 2024
1 parent eda8e42 commit 324d4f0
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 2 deletions.
25 changes: 24 additions & 1 deletion db/mongo-init.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,27 @@ db.createUser({

db = new Mongo().getDB(process.env.MONGO_INITDB_DATABASE);

load('./src/todos.js');
// load('./src/todos.js');

db.createCollection('todos');

db.todos.insertMany([
{
title: 'Node.js',
completed: false,
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString(),
},
{
title: 'Fastify',
completed: true,
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString(),
},
{
title: 'MongoDB',
completed: false,
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString(),
},
]);
13 changes: 12 additions & 1 deletion db/src/todos.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
// db = connect('mongodb://root:[email protected]:27017/mydb?retryWrites=true&w=majority');

db.createCollection('todos');

db.insertMany([
db.todos.insertMany([
{
title: 'Node.js',
completed: false,
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString(),
},
{
title: 'Fastify',
completed: true,
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString(),
},
{
title: 'MongoDB',
completed: false,
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString(),
},
]);

0 comments on commit 324d4f0

Please sign in to comment.