Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
Motion Bank
Services
Motion Bank API
Commits
95eeed1b
Commit
95eeed1b
authored
Oct 10, 2018
by
A. Koch
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update existing records on import
parent
07d27835
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
2 deletions
+6
-2
bin/import.js
bin/import.js
+6
-2
No files found.
bin/import.js
View file @
95eeed1b
...
...
@@ -35,7 +35,9 @@ const proc = async function (folder) {
if
(
m
[
0
]
===
'
.
'
)
continue
const
file
=
await
fs
.
readFile
(
path
.
join
(
folder
,
'
maps
'
,
m
))
const
entry
=
JSON
.
parse
(
file
)
await
mapsClient
.
create
(
updateAuthor
(
entry
))
const
existing
=
await
mapsClient
.
get
(
entry
.
uuid
)
if
(
existing
)
await
mapsClient
.
update
(
entry
.
uuid
,
updateAuthor
(
entry
))
else
await
mapsClient
.
create
(
updateAuthor
(
entry
))
}
const
annoClient
=
new
MongoDB
(
...
...
@@ -49,7 +51,9 @@ const proc = async function (folder) {
if
(
a
[
0
]
===
'
.
'
)
continue
const
file
=
await
fs
.
readFile
(
path
.
join
(
folder
,
'
annotations
'
,
a
))
const
entry
=
JSON
.
parse
(
file
)
await
annoClient
.
create
(
updateAuthor
(
entry
))
const
existing
=
await
annoClient
.
get
(
entry
.
uuid
)
if
(
existing
)
await
annoClient
.
update
(
entry
.
uuid
,
updateAuthor
(
entry
))
else
await
annoClient
.
create
(
updateAuthor
(
entry
))
}
const
cfg
=
config
.
get
(
'
acl.mongodb
'
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment