
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
mongoose-simple-pagination
Advanced tools
Mongoose simple pagination plugin written specially for typescript and async purposes
Mongoose simple pagination plugin written specially for typescript and async purposes.
I created this package because I met typing problems in alternative libraries such as mongoose-paginate-v2. This package is for people who looking for typescript solution with typings.
npm i mongoose-simple-pagination
Add plugin to a schema and then use model paginate
method:
import { Document, model, Schema } from 'mongoose';
import { mongooseSimplePagination, PaginationModel } from 'mongoose-simple-pagination';
interface Product extends Document {
// ...
}
const productSchema = new Schema<Product>(
{
// ...
}
);
productSchema.plugin(mongoosePaginate);
export const ProductModel = model<Product, PaginationModel<Product>>(
'Product',
productSchema,
'products'
);
(async () => {
const pagination = await ProductModel.paginate();
const products = pagination.documents; // Our products array.
const hasNextPage = pagination.hasNextPage; // true.
})();
Returns promise
Parameters
[filter]
{FilterQuery} - Filter query criteria. Documentation[options]
{Options}
[collation]
{CollationDocument} - Specify the collation. Documentation[lean=false]
{boolean | any} - Should return plain javascript objects instead of Mongoose document object.[page=1]
{number}[perPage=20]
{number}[populate]
{string | PopulateOptions | PopulateOptions[]} - Paths which should be populated with other
documents. Documentation[projection=null]
{any | null} - Get/set the query
projection. Documentation[queryOptions={}]
{QueryOptions | null} - Query options passed to Mongoose's find()
function. Documentation[select='']
{string | any} - Fields to return (by default returns all fields)
. Documentation[sort='']
{string | any} - Sort order. DocumentationReturn value
Promise fulfilled with Pagination object having properties:
documents
{T[]} - Array of documents.hasNextPage
{bool} - Availability of next page.hasPreviousPage
{bool} - Availability of previous page.nextPage
{number} - Next page number if available or NULL.page
{number} - Current page number.perPage
{number} - Number of documents per page.previousPage
{number} - Previous page number if available or NULL.totalDocuments
{number} - Total number of documents in collection that match a query.totalPages
{number} - Total number of pages.FAQs
Mongoose simple pagination plugin written specially for typescript and async purposes
The npm package mongoose-simple-pagination receives a total of 0 weekly downloads. As such, mongoose-simple-pagination popularity was classified as not popular.
We found that mongoose-simple-pagination demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.