Questions tagged [nedb]

Embedded persistent database for Node.js, written in Javascript, with no dependency (except npm modules of course). You can think of it as a SQLite for Node.js projects, which can be used with a simple `require` statement. The API is a subset of MongoDB's. You can use it as a persistent or an in-memory only datastore.

About

NeDB is not intended to be a replacement of large-scale databases such as MongoDB! Its goal is to provide you with a clean and easy way to query data and persist it to disk, for web applications that do not need lots of concurrent connections, for example a continuous integration and deployment server and desktop applications built with Node Webkit or Electron.

Links

195 questions
1
vote
1 answer

How to return a response and then redirect in nedb?

My code, in short, is res.status(200).end(); return res.redirect("/"); but this gives an error saying Cannot set headers after they are sent to the client.
SilentDev
  • 20,997
  • 28
  • 111
  • 214
1
vote
2 answers

How to create HTML button based on database content?

Trying to learn handling database information and my mission has been to dynamically create buttons based on content from a database query. My Javascript is as follows: var Datastrore = require("nedb"); var db = new Datastrore({ filename:…
Christophermp
  • 176
  • 1
  • 3
  • 13
1
vote
1 answer

NeDB ( with Vue-Electron ) couldn't save local DB file

I'm developing Vue-Electron with NeDB. On using NeDB, I've encountered problem that NeDB don't save local file though I set option filename and autoload: true. I tried output log of db object when load NeDB, it correct path set. Datastore…
John Smith
  • 11
  • 1
  • 7
1
vote
1 answer

When creating a feathers service with nedb, is it possible to define a unique index?

I made a feathers service using nedb with feathers generate service Let's say the service is called warehouses and I want to have a unique index on the name. The Nedb docs tell me I can create a unique index with db.ensureIndex, but I cannot seem to…
1
vote
1 answer

Nedb non-unique _id indexing

I have a Nedb database for my electron.js app that generates _id replicas even with ensureIndex({… unique: true}). Onclick, an indexed value is to increment by 5 - instead a new index is generated with said value. Example: // Before…
OverLordGoldDragon
  • 1
  • 9
  • 53
  • 101
1
vote
2 answers

How to sort Date on NeDb Database with JavaScript

How can I sort Dates like below in a NeDb Database with a JavaScript function? This sort command in the function loaddata() does not work: loaddata() { this.$db.DBData.find({}).sort({ pubDate: 1 }).exec((err, docs) => { this.Data = docs; …
lannenere
  • 69
  • 1
  • 2
  • 5
1
vote
3 answers

rename error while using nedb

while using nedb, I get rename error as /home/rajiv/Coding/vote-for-change/node_modules/nedb/lib/datastore.js:77 if (err) { throw err; } ^ Error: ENOENT: no such file or directory, rename…
Rajiv Sah
  • 21
  • 1
1
vote
1 answer

Javascript Array looks like its empty but has a value

I am a novice on javascript and starting to learn objects and arrays I just want to know why my array looks like its empty but when you click it has a value? See below code, I am using nedb and Framework7. var DeviceArray = new Array(); db.find({},…
Sarotobi
  • 707
  • 1
  • 9
  • 28
1
vote
1 answer

How do I send image file with nedb

I using nedb. How do I image upload? I'm trying this code. But, there is no saved evidence. const Nedb = require('nedb'); const path = require('path'); const { remote } = require('electron'); const dbPath = remote.app.getPath('userData'); const…
lion
  • 25
  • 5
1
vote
1 answer

Can I use a file based database on Heroku?

I have a small Node.js / Express app deployed to Heroku. I'd like to use a lightweight database like NeDB to persist some data. Is it possible to periodically backup / copy a file from Heroku if I used this approach?
jrasm91
  • 394
  • 2
  • 10
1
vote
1 answer

Electronjs : Saving a db file after compilation

So I created a small electronJs desktop application, and for the data storage I used nedb. In dev mode, it works perfectly fine, but when I compile in production (I'm on mac), I can't write the database file anymore. Here is the code I use to…
David Martins
  • 111
  • 1
  • 1
  • 7
1
vote
1 answer

checking if certain row exist in nedb

i have looked all around trying to find a solution for this but i cant seem to find it i am trying to see if a certain row exist in my nedb database and if it doesnt exist insert something but if it does exist then just move along here is what i…
Nik Hendricks
  • 244
  • 2
  • 6
  • 29
1
vote
1 answer

TypeError: Name.default is not a constructor

I am writing a unit test for a service class called TaskService. The unit test injects a TaskService instance, whose constructor goes ahead to create a DB connection to NeDB. (i know I should mock this connection but I need to get the unit test…
danielbker
  • 392
  • 1
  • 3
  • 21
1
vote
2 answers

Converting NeDB find() results to observable

The question is simple: how do I make method find() return an Observable with found docs inside of it? If I use promises, everything works fine. getData(){ return new Promise((resolve, reject) => { this.db.find({}, (err, docs) => { if (err)…
Ivan Bespalov
  • 147
  • 1
  • 12
1
vote
1 answer

Callback function working with promises but not observables

In my project I have a service that loads data from NeDB. For this purpose I have a method getData(). In my component, using ngOnInit() hook I call this method. Here's where the problem lies. If getData() uses promises everything works as intended…