Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ Once a document is saved, it will automatically be assigned a unique identifier

If you specified a default value (or function) for a schema variable, that value will be assigned on creation of the object.

An alternative to `.save()` is `.findOneAndUpdate(query, update, options)`. This static method will find and update (or insert) a document in one atomic operation (atomicity is guaranteed in MongoDB only). Using the `{upsert: true}` option will return a new document if one is not found with the given query.
An alternative to `.save()` is `.findOneAndUpdate(query, update, options)`. This static method will find and update (or insert) a document in one atomic operation (atomicity is guaranteed in MongoDB only). Using the `{upsert: true}` option will return a new document if one is not found with the given query. For NeDB, you can use the option `{manual: true}` to specify field modifiers manually (see NeDB [docs](https://github.com/seald/nedb#updating-documents) for a complete list).

### Loading

Expand Down
4 changes: 2 additions & 2 deletions lib/clients/nedbclient.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ class NeDbClient extends DatabaseClient {
return resolve(null);
}
} else {
return db.update(query, { $set: values }, function(error, result) {
return db.update(query, options.manual ? values : { $set: values }, function(error, result) {
if (error) return reject(error);

// Fixes issue #55. Remove when NeDB is updated to v1.8+
Expand Down Expand Up @@ -468,7 +468,7 @@ class NeDbClient extends DatabaseClient {
* @return {boolean}
*/
isNativeId(value) {
return String(value).match(/^[a-zA-Z0-9]{16}$/) !== null;
return String(value).match(/^[a-zA-Z0-9-]*$/) !== null;
}

/**
Expand Down