Skip to content

Instantly share code, notes, and snippets.

Trần Văn Luận luandevpro

Block or report user

Report or block luandevpro

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View getPost.js
exports = function(payload, response) {
const atlas = context.services.get('mongodb-atlas');
return atlas
.db('apitutorial')
.collection('posts')
.aggregate([
{
$match: {
_id: BSON.ObjectId(payload.query.id),
},
View getPost.js
exports = function(payload, response) {
const atlas = context.services.get('mongodb-atlas');
return atlas
.db('apitutorial')
.collection('posts')
.aggregate([
{
$match: {
_id: BSON.ObjectId(payload.query.id),
},
View getPost.js
exports = function(payload, response) {
const atlas = context.services.get('mongodb-atlas');
return atlas
.db('apitutorial')
.collection('posts')
.aggregate([
{
$match: {
_id: BSON.ObjectId(payload.query.id),
},
View createPost.js
exports = function(payload, response) {
const atlas = context.services.get('mongodb-atlas');
return atlas
.db('apitutorial')
.collection('posts')
.insertOne({
title: payload.query.title,
description: payload.query.description,
userId: BSON.ObjectId(payload.query.userId)
});
View createPost.js
exports = function(payload, response) {
const atlas = context.services.get('mongodb-atlas');
return atlas
.db('apitutorial')
.collection('posts')
.insertOne({
title: payload.query.title,
description: payload.query.description,
userId: payload.query.userId
});
View getUser.js
exports = function(payload, response) {
const atlas = context.services.get("mongodb-atlas");
return atlas.db("apitutorial").collection("users").findOne({_id: BSON.ObjectId(payload.query.id)},{name: 1, age: 1});
};
View deleteUser.js
exports = function(payload, response) {
const atlas = context.services.get('mongodb-atlas');
return atlas
.db('apitutorial')
.collection('users')
.deleteOne( { "_id" : BSON.ObjectId("5da70fac779328202b2c7fad")});
};
View updateUser.js
exports = function(payload, response) {
const atlas = context.services.get('mongodb-atlas');
return atlas
.db('apitutorial')
.collection('users')
.findOneAndUpdate(
{ _id: BSON.ObjectId(payload.query.id) },
{
$set: {
email: payload.query.email,
View function.js
exports = function(payload, response) {
const atlas = context.services.get('mongodb-atlas');
return atlas
.db('apitutorial')
.collection('users')
.findOne({ _id: BSON.ObjectId(payload.query.id) });
};
View function.js
exports = function(payload, response) {
const atlas = context.services.get('mongodb-atlas');
return atlas
.db('apitutorial')
.collection('users')
.insertOne({
name: payload.query.name,
email: payload.query.email,
password: payload.query.password,
age: payload.query.age,
You can’t perform that action at this time.