Skip to content

Commit

Permalink
chore: upgrade mongodb driver to v4
Browse files Browse the repository at this point in the history
  • Loading branch information
simllll committed Aug 27, 2021
1 parent bed4f72 commit b79ddae
Show file tree
Hide file tree
Showing 25 changed files with 251 additions and 245 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [6.0.0](https://github.com/hokify/agenda/compare/v5.0.1...v6.0.0) (2021-08-27)
* Upgrade to mongo driver 4

### [5.0.1](https://github.com/hokify/agenda/compare/v5.0.0...v5.0.1) (2021-02-12)

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
# Fork
This is a fork of agenda js, it differs from the original version in following points:
- Complete rewrite in Typescript (fully typed!)
- mongodb4 driver
- Supports mongoDB sharding by name
- touch() can have an optional progress parameter (0-100)
- Bugfixes and improvements for locking & job processing (concurrency, lockLimit,..)
Expand Down
26 changes: 13 additions & 13 deletions docs/agenda/1.0.3/agenda_find-and-lock-next-job.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">



<!-- start Mixpanel -->
<script type="text/javascript">(function(e,a){if(!a.__SV){var b=window;try{var c,l,i,j=b.location,g=j.hash;c=function(a,b){return(l=a.match(RegExp(b+"=([^&]*)")))?l[1]:null};g&&c(g,"state")&&(i=JSON.parse(decodeURIComponent(c(g,"state"))),"mpeditor"===i.action&&(b.sessionStorage.setItem("_mpcehash",g),history.replaceState(i.desiredHash||"",e.title,j.pathname+j.search)))}catch(m){}var k,h;window.mixpanel=a;a._i=[];a.init=function(b,c,f){function e(b,a){var c=a.split(".");2==c.length&&(b=b[c[0]],a=c[1]);b[a]=function(){b.push([a].concat(Array.prototype.slice.call(arguments,
Expand Down Expand Up @@ -52,17 +52,17 @@
<ul>
<li >
<a href="index.html">

<svg fill="#6D6D6D" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg">
<path d="M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z"/>
<path d="M0 0h24v24H0z" fill="none"/>
</svg>


</a>
</li>



</ul>
</div>
Expand All @@ -76,14 +76,14 @@ <h3>Classes</h3><ul><li id="Agenda-nav"><a href="Agenda.html">Agenda</a><ul clas
</nav>

<div id="main">

<h1 class="page-title">
agenda/find-and-lock-next-job.js
</h1>








<section>
<article>
Expand Down Expand Up @@ -157,7 +157,7 @@ <h1 class="page-title">
* Query used to affect what gets returned
* @type {{returnOriginal: boolean, sort: object}}
*/
const JOB_RETURN_QUERY = {returnOriginal: false, sort: this._sort};
const JOB_RETURN_QUERY = {returnDocument: 'after', sort: this._sort};

// Find ONE and ONLY ONE job and set the 'lockedAt' time so that job begins to be processed
this._collection.findOneAndUpdate(JOB_PROCESS_WHERE_QUERY, JOB_PROCESS_SET_QUERY, JOB_RETURN_QUERY, (err, result) => {
Expand All @@ -177,7 +177,7 @@ <h1 class="page-title">
</article>
</section>




</div>
Expand All @@ -191,7 +191,7 @@ <h1 class="page-title">
<script src="scripts/linenumber.js"></script>
<script src="scripts/pagelocation.js"></script>



</body>
</html>
30 changes: 15 additions & 15 deletions docs/agenda/1.0.3/agenda_save-job.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">



<!-- start Mixpanel -->
<script type="text/javascript">(function(e,a){if(!a.__SV){var b=window;try{var c,l,i,j=b.location,g=j.hash;c=function(a,b){return(l=a.match(RegExp(b+"=([^&]*)")))?l[1]:null};g&&c(g,"state")&&(i=JSON.parse(decodeURIComponent(c(g,"state"))),"mpeditor"===i.action&&(b.sessionStorage.setItem("_mpcehash",g),history.replaceState(i.desiredHash||"",e.title,j.pathname+j.search)))}catch(m){}var k,h;window.mixpanel=a;a._i=[];a.init=function(b,c,f){function e(b,a){var c=a.split(".");2==c.length&&(b=b[c[0]],a=c[1]);b[a]=function(){b.push([a].concat(Array.prototype.slice.call(arguments,
Expand Down Expand Up @@ -52,17 +52,17 @@
<ul>
<li >
<a href="index.html">

<svg fill="#6D6D6D" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg">
<path d="M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z"/>
<path d="M0 0h24v24H0z" fill="none"/>
</svg>


</a>
</li>



</ul>
</div>
Expand All @@ -76,14 +76,14 @@ <h3>Classes</h3><ul><li id="Agenda-nav"><a href="Agenda.html">Agenda</a><ul clas
</nav>

<div id="main">

<h1 class="page-title">
agenda/save-job.js
</h1>








<section>
<article>
Expand Down Expand Up @@ -168,7 +168,7 @@ <h1 class="page-title">
const result = await this._collection.findOneAndUpdate(
{_id: id},
update,
{returnOriginal: false}
{returnDocument: 'after'}
);
return processDbResult(job, result);
} else if (props.type === 'single') {
Expand Down Expand Up @@ -198,7 +198,7 @@ <h1 class="page-title">
},
update, {
upsert: true,
returnOriginal: false
returnDocument: 'after'
});
return processDbResult(job, result);
} else if (unique) {
Expand All @@ -211,7 +211,7 @@ <h1 class="page-title">

// Use the 'unique' query object to find an existing job or create a new one
debug('calling findOneAndUpdate() with unique object as query: \n%O', query);
const result = await this._collection.findOneAndUpdate(query, update, {upsert: true, returnOriginal: false});
const result = await this._collection.findOneAndUpdate(query, update, {upsert: true, returnDocument: 'after'});
return processDbResult(job, result);
}
// If all else fails, the job does not exist yet so we just insert it into MongoDB
Expand All @@ -227,7 +227,7 @@ <h1 class="page-title">
</article>
</section>




</div>
Expand All @@ -241,7 +241,7 @@ <h1 class="page-title">
<script src="scripts/linenumber.js"></script>
<script src="scripts/pagelocation.js"></script>



</body>
</html>
26 changes: 13 additions & 13 deletions docs/agenda/1.0.3/utils_process-jobs.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">



<!-- start Mixpanel -->
<script type="text/javascript">(function(e,a){if(!a.__SV){var b=window;try{var c,l,i,j=b.location,g=j.hash;c=function(a,b){return(l=a.match(RegExp(b+"=([^&]*)")))?l[1]:null};g&&c(g,"state")&&(i=JSON.parse(decodeURIComponent(c(g,"state"))),"mpeditor"===i.action&&(b.sessionStorage.setItem("_mpcehash",g),history.replaceState(i.desiredHash||"",e.title,j.pathname+j.search)))}catch(m){}var k,h;window.mixpanel=a;a._i=[];a.init=function(b,c,f){function e(b,a){var c=a.split(".");2==c.length&&(b=b[c[0]],a=c[1]);b[a]=function(){b.push([a].concat(Array.prototype.slice.call(arguments,
Expand Down Expand Up @@ -52,17 +52,17 @@
<ul>
<li >
<a href="index.html">

<svg fill="#6D6D6D" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg">
<path d="M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z"/>
<path d="M0 0h24v24H0z" fill="none"/>
</svg>


</a>
</li>



</ul>
</div>
Expand All @@ -76,14 +76,14 @@ <h3>Classes</h3><ul><li id="Agenda-nav"><a href="Agenda.html">Agenda</a><ul clas
</nav>

<div id="main">

<h1 class="page-title">
utils/process-jobs.js
</h1>








<section>
<article>
Expand Down Expand Up @@ -244,7 +244,7 @@ <h1 class="page-title">

// Update / options for the MongoDB query
const update = {$set: {lockedAt: now}};
const options = {returnOriginal: false};
const options = {returnDocument: 'after'};

// Lock the job in MongoDB!
self._collection.findOneAndUpdate(criteria, update, options, (err, resp) => {
Expand Down Expand Up @@ -427,7 +427,7 @@ <h1 class="page-title">
</article>
</section>




</div>
Expand All @@ -441,7 +441,7 @@ <h1 class="page-title">
<script src="scripts/linenumber.js"></script>
<script src="scripts/pagelocation.js"></script>



</body>
</html>
26 changes: 13 additions & 13 deletions docs/agenda/2.0.0/agenda_find-and-lock-next-job.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">



<!-- start Mixpanel -->
<script type="text/javascript">(function(e,a){if(!a.__SV){var b=window;try{var c,l,i,j=b.location,g=j.hash;c=function(a,b){return(l=a.match(RegExp(b+"=([^&]*)")))?l[1]:null};g&&c(g,"state")&&(i=JSON.parse(decodeURIComponent(c(g,"state"))),"mpeditor"===i.action&&(b.sessionStorage.setItem("_mpcehash",g),history.replaceState(i.desiredHash||"",e.title,j.pathname+j.search)))}catch(m){}var k,h;window.mixpanel=a;a._i=[];a.init=function(b,c,f){function e(b,a){var c=a.split(".");2==c.length&&(b=b[c[0]],a=c[1]);b[a]=function(){b.push([a].concat(Array.prototype.slice.call(arguments,
Expand Down Expand Up @@ -52,17 +52,17 @@
<ul>
<li >
<a href="index.html">

<svg fill="#6D6D6D" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg">
<path d="M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z"/>
<path d="M0 0h24v24H0z" fill="none"/>
</svg>


</a>
</li>



</ul>
</div>
Expand All @@ -76,14 +76,14 @@ <h3>Classes</h3><ul><li id="Agenda-nav"><a href="Agenda.html">Agenda</a><ul clas
</nav>

<div id="main">

<h1 class="page-title">
agenda/find-and-lock-next-job.js
</h1>








<section>
<article>
Expand Down Expand Up @@ -157,7 +157,7 @@ <h1 class="page-title">
* Query used to affect what gets returned
* @type {{returnOriginal: boolean, sort: object}}
*/
const JOB_RETURN_QUERY = {returnOriginal: false, sort: this._sort};
const JOB_RETURN_QUERY = {returnDocument: 'after', sort: this._sort};

// Find ONE and ONLY ONE job and set the 'lockedAt' time so that job begins to be processed
this._collection.findOneAndUpdate(JOB_PROCESS_WHERE_QUERY, JOB_PROCESS_SET_QUERY, JOB_RETURN_QUERY, (err, result) => {
Expand All @@ -177,7 +177,7 @@ <h1 class="page-title">
</article>
</section>




</div>
Expand All @@ -191,7 +191,7 @@ <h1 class="page-title">
<script src="scripts/linenumber.js"></script>
<script src="scripts/pagelocation.js"></script>



</body>
</html>
Loading

0 comments on commit b79ddae

Please sign in to comment.