Fullcalendar fetch from mongodb [duplicate]












0
















This question already has an answer here:




  • mongodb Querying for a Date Range when date is saved as string

    1 answer



  • Find objects between two dates MongoDB

    11 answers




I'm trying to get my fullcalendar working with mongodb, but I'm stuck while trying to fetch events from database and unfortunately when it comes to pulling from mongodb, it doesn't seem to have many resources out there.



In mongodb I have events stored as:



"availability" : `[ { "start" : "09.28.2018 11:00", "end" : "09.28.2018 16:00" }, { "start" : "09.28.2018 16:00", "end" : "09.28.2018 17:00" }, { "start" : "09.30.2018 16:00", "end" : "09.30.2018 23:00" }, { "start" : "10.25.2018 10:00:00", "end" : "10.25.2018 15:00:00" } ]`


NodeJS part of the code that opens the calendar:



router.get("/calendar", function(req, res){
... })


And I have tried to make ajax call(unsuccessfully):



$.ajax({
url : '/calendar',
type : 'post',
dataType: 'json',
success: function(e){
if(e.success){
var availability = ;
$.each(e.availability,function(index,value){
availability.push({
title : value.title,
start : moment(value.start).format('YYYY-MM-DD'),
end : moment(value.end).format('YYYY-MM-DD'),
});
});
calendar.fullCalendar( 'addEventSource', availability);
}
}
});


What do I need to fix to get calendar to fetch events from database stored as is?










share|improve this question













marked as duplicate by Neil Lunn mongodb
Users with the  mongodb badge can single-handedly close mongodb questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 24 '18 at 21:59


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.



















  • You need to fix your dates as a first priority. "09.28.2018 11:00" is not a lexical format or a correct BSON Date as explained in the linked answers, and therefore does not work with the range search which is required. Fix the dates and then the demonstrated range query examples are what you want.

    – Neil Lunn
    Nov 24 '18 at 22:04











  • @NeilLunn I have fixed it now( I guess?) "2018.11.15 11:00", but still confused how to get fullcalendar to fetch the events, Any tips on that?

    – niko nikić
    Nov 25 '18 at 20:08











  • Read the linked answers in the very large box above your question.

    – Neil Lunn
    Nov 25 '18 at 20:09
















0
















This question already has an answer here:




  • mongodb Querying for a Date Range when date is saved as string

    1 answer



  • Find objects between two dates MongoDB

    11 answers




I'm trying to get my fullcalendar working with mongodb, but I'm stuck while trying to fetch events from database and unfortunately when it comes to pulling from mongodb, it doesn't seem to have many resources out there.



In mongodb I have events stored as:



"availability" : `[ { "start" : "09.28.2018 11:00", "end" : "09.28.2018 16:00" }, { "start" : "09.28.2018 16:00", "end" : "09.28.2018 17:00" }, { "start" : "09.30.2018 16:00", "end" : "09.30.2018 23:00" }, { "start" : "10.25.2018 10:00:00", "end" : "10.25.2018 15:00:00" } ]`


NodeJS part of the code that opens the calendar:



router.get("/calendar", function(req, res){
... })


And I have tried to make ajax call(unsuccessfully):



$.ajax({
url : '/calendar',
type : 'post',
dataType: 'json',
success: function(e){
if(e.success){
var availability = ;
$.each(e.availability,function(index,value){
availability.push({
title : value.title,
start : moment(value.start).format('YYYY-MM-DD'),
end : moment(value.end).format('YYYY-MM-DD'),
});
});
calendar.fullCalendar( 'addEventSource', availability);
}
}
});


What do I need to fix to get calendar to fetch events from database stored as is?










share|improve this question













marked as duplicate by Neil Lunn mongodb
Users with the  mongodb badge can single-handedly close mongodb questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 24 '18 at 21:59


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.



















  • You need to fix your dates as a first priority. "09.28.2018 11:00" is not a lexical format or a correct BSON Date as explained in the linked answers, and therefore does not work with the range search which is required. Fix the dates and then the demonstrated range query examples are what you want.

    – Neil Lunn
    Nov 24 '18 at 22:04











  • @NeilLunn I have fixed it now( I guess?) "2018.11.15 11:00", but still confused how to get fullcalendar to fetch the events, Any tips on that?

    – niko nikić
    Nov 25 '18 at 20:08











  • Read the linked answers in the very large box above your question.

    – Neil Lunn
    Nov 25 '18 at 20:09














0












0








0









This question already has an answer here:




  • mongodb Querying for a Date Range when date is saved as string

    1 answer



  • Find objects between two dates MongoDB

    11 answers




I'm trying to get my fullcalendar working with mongodb, but I'm stuck while trying to fetch events from database and unfortunately when it comes to pulling from mongodb, it doesn't seem to have many resources out there.



In mongodb I have events stored as:



"availability" : `[ { "start" : "09.28.2018 11:00", "end" : "09.28.2018 16:00" }, { "start" : "09.28.2018 16:00", "end" : "09.28.2018 17:00" }, { "start" : "09.30.2018 16:00", "end" : "09.30.2018 23:00" }, { "start" : "10.25.2018 10:00:00", "end" : "10.25.2018 15:00:00" } ]`


NodeJS part of the code that opens the calendar:



router.get("/calendar", function(req, res){
... })


And I have tried to make ajax call(unsuccessfully):



$.ajax({
url : '/calendar',
type : 'post',
dataType: 'json',
success: function(e){
if(e.success){
var availability = ;
$.each(e.availability,function(index,value){
availability.push({
title : value.title,
start : moment(value.start).format('YYYY-MM-DD'),
end : moment(value.end).format('YYYY-MM-DD'),
});
});
calendar.fullCalendar( 'addEventSource', availability);
}
}
});


What do I need to fix to get calendar to fetch events from database stored as is?










share|improve this question















This question already has an answer here:




  • mongodb Querying for a Date Range when date is saved as string

    1 answer



  • Find objects between two dates MongoDB

    11 answers




I'm trying to get my fullcalendar working with mongodb, but I'm stuck while trying to fetch events from database and unfortunately when it comes to pulling from mongodb, it doesn't seem to have many resources out there.



In mongodb I have events stored as:



"availability" : `[ { "start" : "09.28.2018 11:00", "end" : "09.28.2018 16:00" }, { "start" : "09.28.2018 16:00", "end" : "09.28.2018 17:00" }, { "start" : "09.30.2018 16:00", "end" : "09.30.2018 23:00" }, { "start" : "10.25.2018 10:00:00", "end" : "10.25.2018 15:00:00" } ]`


NodeJS part of the code that opens the calendar:



router.get("/calendar", function(req, res){
... })


And I have tried to make ajax call(unsuccessfully):



$.ajax({
url : '/calendar',
type : 'post',
dataType: 'json',
success: function(e){
if(e.success){
var availability = ;
$.each(e.availability,function(index,value){
availability.push({
title : value.title,
start : moment(value.start).format('YYYY-MM-DD'),
end : moment(value.end).format('YYYY-MM-DD'),
});
});
calendar.fullCalendar( 'addEventSource', availability);
}
}
});


What do I need to fix to get calendar to fetch events from database stored as is?





This question already has an answer here:




  • mongodb Querying for a Date Range when date is saved as string

    1 answer



  • Find objects between two dates MongoDB

    11 answers








node.js mongodb fullcalendar






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 24 '18 at 21:58









niko nikićniko nikić

33




33




marked as duplicate by Neil Lunn mongodb
Users with the  mongodb badge can single-handedly close mongodb questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 24 '18 at 21:59


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.









marked as duplicate by Neil Lunn mongodb
Users with the  mongodb badge can single-handedly close mongodb questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 24 '18 at 21:59


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.















  • You need to fix your dates as a first priority. "09.28.2018 11:00" is not a lexical format or a correct BSON Date as explained in the linked answers, and therefore does not work with the range search which is required. Fix the dates and then the demonstrated range query examples are what you want.

    – Neil Lunn
    Nov 24 '18 at 22:04











  • @NeilLunn I have fixed it now( I guess?) "2018.11.15 11:00", but still confused how to get fullcalendar to fetch the events, Any tips on that?

    – niko nikić
    Nov 25 '18 at 20:08











  • Read the linked answers in the very large box above your question.

    – Neil Lunn
    Nov 25 '18 at 20:09



















  • You need to fix your dates as a first priority. "09.28.2018 11:00" is not a lexical format or a correct BSON Date as explained in the linked answers, and therefore does not work with the range search which is required. Fix the dates and then the demonstrated range query examples are what you want.

    – Neil Lunn
    Nov 24 '18 at 22:04











  • @NeilLunn I have fixed it now( I guess?) "2018.11.15 11:00", but still confused how to get fullcalendar to fetch the events, Any tips on that?

    – niko nikić
    Nov 25 '18 at 20:08











  • Read the linked answers in the very large box above your question.

    – Neil Lunn
    Nov 25 '18 at 20:09

















You need to fix your dates as a first priority. "09.28.2018 11:00" is not a lexical format or a correct BSON Date as explained in the linked answers, and therefore does not work with the range search which is required. Fix the dates and then the demonstrated range query examples are what you want.

– Neil Lunn
Nov 24 '18 at 22:04





You need to fix your dates as a first priority. "09.28.2018 11:00" is not a lexical format or a correct BSON Date as explained in the linked answers, and therefore does not work with the range search which is required. Fix the dates and then the demonstrated range query examples are what you want.

– Neil Lunn
Nov 24 '18 at 22:04













@NeilLunn I have fixed it now( I guess?) "2018.11.15 11:00", but still confused how to get fullcalendar to fetch the events, Any tips on that?

– niko nikić
Nov 25 '18 at 20:08





@NeilLunn I have fixed it now( I guess?) "2018.11.15 11:00", but still confused how to get fullcalendar to fetch the events, Any tips on that?

– niko nikić
Nov 25 '18 at 20:08













Read the linked answers in the very large box above your question.

– Neil Lunn
Nov 25 '18 at 20:09





Read the linked answers in the very large box above your question.

– Neil Lunn
Nov 25 '18 at 20:09












0






active

oldest

votes

















0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes

Popular posts from this blog

404 Error Contact Form 7 ajax form submitting

How to know if a Active Directory user can login interactively

Refactoring coordinates for Minecraft Pi buildings written in Python